(My) Coding Standards

Note

Moving content to our Standards document where I can…

import

From The Best (and Worst) of Django

Use non-project-relative imports:

import app.models

…not import project.app.models

Use relative imports where possible (see PEP0328):

from . import x

manage.py

From The Best (and Worst) of Django

Stop using manage.py and see virtualenv.

settings.py

From The Best (and Worst) of Django:

settings
|-- __init__.py
|-- base.py
|-- staging.py
|-- production.py
|-- local.py
# base.py
INSTALLED_APPS  =  [...]
# local.py
from settings.base import  *
INSTALLED_APPS += ['debug_toolbar']
$ django-admin.py shell --settings=settings.local
# deploy.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.deploy'

Note: I think the last line should read settings.production.

Style

View

# view name
def region_routing_view(request):

# url name
url(r'^store/$', region_routing_view, name='region_routing'),

# template name
region_routing.html

# test name
def test_region_routing_view(self):