Django directory structure?

Solution 1:

Common structures

In Django 1.4+

project_root/
   project_name/
       media/
       static/
           some_app/css/app.css  # overriding an app css file from project level
           css/
               project.css
       static_root/  # in production using the collectstatic command
       templates/some_app/foo.html  # overriding some_app at project level
                /admin/some_app/some_model/change_list.html
                # overriding admin changelist for some_app.models.some_model
       settings/
           __init__.py
           base.py    # settings common to all instances of the project
           dev.py
           staging.py
           test.py
           prod.py
       urls.py
   some_app/
       static/
           css/
               app.css
       templates/some_app/foo.html
       urls.py
       views.py
       models.py
   manage.py

In Django 1.3 and prior

project_root/
   some_app/
       templates/some_app/foo.html
       static/
           css/
               app.css
       urls.py
       views.py
       models.py
   media/
   static/
       some_app/
           css/
               app.css  # overriding an app css file from project level
       css/
           project.css
   static_root/ (in production)
   templates/some_app/foo.html # overriding some_app at project level
            /admin/some_app/some_model/change_list.html
            # overriding admin changelist for some_app.models.some_model
   settings/
       __init__.py
       base.py    # settings common to all instances of the project
       dev.py
       staging.py
       test.py
       prod.py
   urls.py
   manage.py

Alternative approach

project_root/
    .gitignore
    README.md
    docs/
    venv/
    src/
       main/
           media/
           static/
               some_app/css/app.css  # overriding an app css file from project level
               css/
                   project.css
           static_root/  # in production using the collectstatic command
           templates/some_app/foo.html  # overriding some_app at project level
                    /admin/some_app/some_model/change_list.html
                    # overriding admin changelist for some_app.models.some_model
           settings/
               __init__.py
               base.py
               dev.py
               staging.py
               test.py
               prod.py
           urls.py
       some_app/
           static/
               css/
                   app.css
           templates/some_app/foo.html
           urls.py
           views.py
           models.py
       manage.py
       wsgi.py

Solution 2:

If you need to use the database, you should add the data models to models.py. For your program I recommend writing it in new python files (e.g. queuing.py) that you would import when and where you want to use it. You could create another django app just for this as well.