Django Project Conventions

What is a Django Project

A project in Django is a simple structure that contains a settings file, urls, and a collection of Django Apps. These can be things you have written yourself, or something third party that you choose to include in your project.

Settings

  • Placed in PROJECT/settings.py
  • If you are using an import mechanism, please use from local_settings import * at the bottom of your settings.py file

URLs

  • Placed at PROJECT/urls.py
  • Should contain as little logic as possible, mostly just a pointer to each of your apps specific URLConf's.

Suggested Project layout

example.com/
    local_apps/
        custom apps written for this project (Preferably Reusable; Probably on your PYTHONPATH)
    external_apps/
         External reusable apps you are using on this project
         Note: These apps can also live anywhere on your PYTHONPATH
    projects/
        dev_example/
        production_example/
        django96_example/
            manage.py, settings, urls, etc
     docs/
        This will hold the documentation for your project
    static/
        -In production this will be the root of your MEDIA_URL
        css/
        js/
        images/
    tests/
        - Project level tests (Each app should also have tests)
    uploads/
        - content imgs, etc
    templates/
        - This area is used to override templates from your reusable apps
        flatpages/
        comments/
        example/
        app1/
        app2/