Structuring a Django Project

A trend in some Django applications is to structure your repositories poorly due to the new bundled application templates, by running:

$ django-admin.py startproject samplesite

The resulting repository structure looks like this:

README.rst
samplesite/manage.py
samplesite/samplesite/settings.py
samplesite/samplesite/wsgi.py
samplesite/samplesite/sampleapp/models.py

Repetitive paths are confusing for both you and anyone working with your codebase. Unnecessary nesting doesn’t help anybody.

$ django-admin.py startproject samplesite .

Note the “.”.

The resulting structure:

README.rst
manage.py
samplesite/settings.py
samplesite/wsgi.py
samplesite/sampleapp/models.py

Plan on Structuring Your Python Project correctly from the outset.