Member-only story

A different approach to organizing your Django project

Kevin Tewouda
2 min readSep 18, 2023

--

The single folder application

Photo by Eric Mok on Unsplash

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…

--

--

Kevin Tewouda
Kevin Tewouda

Written by Kevin Tewouda

Déserteur camerounais résidant désormais en France. Passionné de programmation, sport, de cinéma et mangas. J’écris en français et en anglais dû à mes origines.

Responses (3)