Member-only story
A different approach to organizing your Django project
The single folder application
Recently, I faced an issue of package name clashing between a private library we developed in my company and a Django application I was developing. This made me rethink how to organize a Django project.
Default organization
If you follow the official Django tutorial, you will end up with something like the following:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
polls/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
You have the root package mysite and Django applications following along like polls. This works well until you install a third-party package called polls. 😬Now you will have an issue knowing where from polls…
comes from.
New organization
To avoid this situation, this is now the configuration I follow and recommend:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
polls/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py…