Django 1.4.3 keeps using dummy database engine settings value -
Django 1.4.3 keeps using dummy database engine settings value -
i can't figure out why django doesn't utilize database engine specify in settings.py file instead uses value django.db.backends.dummy
.
here db part of my settings.py file located @ /project/app/settings.py:
databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'my_db_name', 'user': 'my_user', 'password': 'my_pass', 'host': '', 'port': '', } }
and here django debug log shows:
databases {'default': {'engine': 'django.db.backends.dummy', 'host': '', 'name': 'my_db_name', 'options': {}, 'password': u'********************', 'port': '', 'test_charset': none, 'test_collation': none, 'test_mirror': none, 'test_name': none, 'time_zone': 'utc', 'user': 'my_user'}}
i'm running site in production gunicorn , nginx. site has setup debug mode true.
update 1: when run python manage.py diffsettings
next (the engine correct):
databases = {'default': {'engine': 'django.db.backends.mysql', 'test_mirror': none, 'name': 'my_db_name', 'test_charset': none, 'time_zone': 'utc', 'test_collation': none, 'options': {}, 'host': '', 'user': 'my_user', 'test_name': none, 'password': 'my_pass', 'port': ''}}
update 2: tried in shell, works expected, can reach db:
# python manage.py shell >>> myapp.models import mymodel >>> test = mymodel.objects.all() >>> test # outputs objects mymodel.
update 3: unusual happening. debug problem commented out installed apps
in settings.py, restarted nginx, django still shows them in debug log:
installed_apps ('django.contrib.auth', 'django.contrib.humanize', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'grappelli', 'django.contrib.admin', 'foureggs', 'registration', 'massadmin')
it looks django using kind of cached version of settings.py file.
here fixed problem in end. i'm not sure real cause looks had running supervisord.
i had 2 virtual environments defined under domain (i.e. /home/mydomain/www/env1 , /home/mydomain/www/env2). problem described in original question env2.
i first thought it's env1 that's causing problems , somehow settings.py used instead of settings.py env2. settings.py in env1 looked totally different wasn't issue.
anyway, here steps i've taken, might give pointers others running same issue:
i deleted env1 (/home/mydomain/www/env1) <-- not related problem deleted envivornment anyway since didn't need it
i killed these processes: supervisord, nginx, gunicorn_django (i.e. pkill supervisord
)
i started supervisord (which runs bash script start gunicorn_django process) , nginx
site worked expected.
django
Comments
Post a Comment