开发者

Modifing settings in Django

开发者 https://www.devze.com 2022-12-24 19:07 出处:网络
I\'m trying to get Django\'s manage.py to run with modified settings files. I have three settings files

I'm trying to get Django's manage.py to run with modified settings files.

I have three settings files

settings.py preview.py live.py

settings.py contains my base settings but on live & preview sites I point the ['DJANGO_SETTINGS_MODULE'] to live or preview which in turn load the base file and any settings specific to that environment.

This works fine, until I try to run migrations using manage.py

I updated the manage.py file to import settings.preview but now when I try to run syncdb or migrate I get this error:

django.core.exceptions.ImproperlyConfigured: You 开发者_StackOverflow中文版haven't set the DATABASE_ENGINE setting yet.

My settings file has this in it though:

DATABASE_ENGINE = 'mysql'

How can I get this to work?


Don't modify manage.py if you can help it. Instead pass it the --settings argument to choose an alternate settings module. Setting up a shell script or alias will make it easier to use this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号