4👍
whereas my initial app from my repo (the one with settings.py
That’s not an application, that’s your project’s configuration.
And no, having the same name for your project’s root directory and it’s configuration directory shouldn’t cause any problem.
That’s even how it’s designed to be so it’s perfectly normal.
Since the wsgi.py (which should be what you use for production) dynamically handles path as long as the internal structure of your project is preserved (don’t rename the project’s configuration directory).
The absolute path to your project isn’t hardcoded, it’s retrieved by getting parent directories of your configuration directory. You can move your project and even rename its root directory.
Here is how it’s handled :
wsgi.py :
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testproject.settings")
wsgi.py
sets the right value to use the right settings.py
file.
settings.py :
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
settings.py
sets BASE_DIR
dynamically. This value is then what’s used for handling pathes to avoid having an hardcoded absolute path that wouldn’t work as soon as you move your project.
1👍
There won’t be any issue with having the different name of parent directory and the project directory (the one with settings.py).
You can try renaming the parent directory and it would still work the same way but the name of project directory should not be touched since the same is linked with project settings which are used to run the project.