ValueError: cannot configure filter "require_debug_false": cannot resolve "django.utils.log.RequireDebugFalse": no module named RequireDebugFalse

I am trying to connect a MySQL database to Django. I have seen many forms, but I can not solve my problem. Below I get when I do python manage.py syncdb :

 Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 252, in fetch_command app_name = get_commands()[subcommand] File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 101, in get_commands apps = settings.INSTALLED_APPS File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 276, in __getattr__ self._setup() File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 139, in __init__ logging_config_func(self.LOGGING) File "/usr/lib/python2.7/logging/config.py", line 777, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python2.7/logging/config.py", line 562, in configure 'filter %r: %s' % (name, e)) ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireDebugFalse': No module named RequireDebugFalse 

I am using virtualenv on Ubuntu.

Registration Information ::

  LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, } 

}

+4
source share
3 answers

From the trace it is clear that you are not using the version of Django installed in virtual env; instead, the version installed in /usr/local/lib/python2.7/dist-packages/django/ .

The configuration is for Django 1.4, but the Ubuntu installation you are using starts Django 1.3 or later.

You need to make sure that you are using virtualenv configured to run without site packages.

+6
source

On my system (Debian Wheezy), the python-django package installs "/ usr / bin / django-admin".

Note the absence of a ".py" in the name. To start django-admin from virtualenv, either provide the full path or name with .py at the end (django-admin.py). Or both.

 (TRIAL) bjb@bjb-pc :~/projects/python/django$ which django-admin /usr/bin/django-admin (TRIAL) bjb@bjb-pc :~/projects/python/django$ which django-admin.py /usr/local/pythonenv/TRIAL/bin/django-admin.py (TRIAL) bjb@bjb-pc :~/projects/python/django$ echo $PATH /usr/local/pythonenv/TRIAL/bin:/home/bjb/bin:/usr/bin/mh:/bin:/usr/bin:/usr/local/bin:/usr/games:/opt/arm-2009q1/bin 

So, although the virtualenv bin directory takes precedence, since there is no "django-admin" file in it, / usr / bin / django -admin gets.

The fact is that if your project was created using the wrong django-admin, you will encounter this error when trying to synchronize or do other things that use executables in virtualenv - as it happened to me just now.

0
source

I have the same problem and solved with this command on the terminal

 user@computer :~$ source /your_django_directory/bin/activate 

Once you do this, it will work out

 (your_django_directory) user@computer :~$ source /your_django_directory/bin/activate 

Try syncdb again.

0
source

All Articles