I have a Django project, version 1.8.7
I am trying to run manage.py.
The manage.py scrip produces an error:
ImportError: No module named project_name.settings
My directory structure is like this:
project_name:
- __init__.py
- other_stuff
- ...
- settings.py
- manage.py
In manage.py I have a line of code like this:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")
If I change project_name.settings
to settings
. I don't get this error anymore ( I get another error down the line, also an import error, but that is besides the point )
On other machines the code works with project_name.settings
.
I imagine this is a pathing issue. How, or better put, where can I fix this path issue? Specifically, how can I tell Django that project_name.settings is actually current_directory.settings?
Thanks!
ANSWER:
So, the fix I found was to make a symlink in the dist-packages of python. I have a symlink, let's call it s, that points to the directory containing my project. The symlink s points to parent_dir.
- parent_dir
- dir_1
- ...
- project_name
- __init__.py
...
- ...
I also added a pth file, s.pth that contains just the name of the symlink, s.
Now, it works.