Question
I want to separate my prod settings from my local settings. I found this library django-split-settings, which worked nicely.
However somewhere in my code I have something like this:
if settings.DEBUG:
# do debug stuff
else:
# do prod stuff
The problem is that when i run my unit test command:
./run ./manage.py test
the above if statements evaluates settings.DEBUG
as false. Which makes me wonder, which settings file is the test command reading from and how to correct it
What I have tried
I tried running a command like this:
./run ./manage.py test --settings=bx/settings
gives me this crash:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/beneple/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/beneple/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/beneple/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/beneple/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/beneple/venv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: Import by filename is not supported.
any ideas?
Aucun commentaire:
Enregistrer un commentaire