background
I'm trying to split my settings by environment by following these instructions.
Now I would like to simply run my test command like so:
./run ./manage.py test --settings=bx.settings.local
currently the following line
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bx.settings")
is available in these files
manage.py
wsgi.py
and so i removed it (since it's supposed to be read from the command line instead).
I also created a settings
folder inside my bx
app and added the files
__init__.py
base.py
local.py
to it.
notes
note: the run
file is this:
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker run \
--env "PATH=/beneple/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
--link beneple_db:db \
-v $DIR:/beneple \
-t -i --rm \
beneple/beneple \
$@
problem
when i run the command
./run ./manage.py test --settings=bx.settings.local
I get this error
File "/beneple/bx/org/serializers.py", line 10, in <module>
from bx.settings import DOMAIN
ImportError: cannot import name DOMAIN
in serializers.py:10, we got this
from bx.settings import DOMAIN
so i replaced bx.settings
with
from django.conf import settings
from settings import DOMAIN
and instead i got this error:
File "/beneple/bx/org/serializers.py", line 12, in <module>
from settings import DOMAIN
ImportError: No module named settings
debugging
the weird part is that if i put a breakpoint after from django.conf import settings
, and type the following:
ipdb> print(settings)
<Settings "bx.settings.local">
ipdb> settings.DOMAIN
'http://localhost:8000'
I'm confused why it's not recognizing settings here as a module?
Aucun commentaire:
Enregistrer un commentaire