JasonTS
JasonTS

Reputation: 2589

Where does Django store the project path?

I want to rename a project which I created with:

django-admin.py startproject

But after renaming the folder and all the references inside my project, I still can't get it to start. It says myproject.settings is not in the pythonpath. Since the old project name is neither in the pythonpath i figure that django must keep these names and paths somewhere else. Where does it store this information ?

I know I could just add the path to sys.path while execution, but i want to fix this completely.

If i run:

python manage.py runserver

I get:

Error: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named settings

The name for 'mysite' is already the correct one and corrosponds with the folder name. But still it can't find it.

Any ideas?

PS: I'm running debian.

Upvotes: 3

Views: 977

Answers (2)

JasonTS
JasonTS

Reputation: 2589

i'm sorry, but the solution was more simple in my case:

one of the apps had the same name i wanted to give to the project. this resulted in the described error message !

sorry for the trouble.

Upvotes: 0

Filip Dupanović
Filip Dupanović

Reputation: 33650

It doesn't store the project path anywhere. Everything is calculated relative to the path you specified for the settings module.

If you renamed your project folder and it's still trying to load the old settings, it's possible that you still have the old settings file configured somewhere, e.g. in the environment DJANGO_SETTINGS_MODULE is still pointing to oldproject.settings or your WSGI server is still configured to load oldproject.settings. Also check that you don't have any package weirdness in your interpreter's site-packages.

Upvotes: 2

Related Questions