Hacker News new | ask | show | jobs
by gregsadetsky 5345 days ago
There's "Django Best Practices", which was discussed two months ago (although it doesn't seem like it grew a lot since): http://lincolnloop.com/django-best-practices/

HN discussion: http://news.ycombinator.com/item?id=2936364

Any effort to assemble "field" knowledge around Django would be great. For instance, I was looking for best practices for splitting settings.py (separating dev, test and prod-specific configs). If anybody's interested, I went through: http://stackoverflow.com/questions/88259/how-do-you-configur... , http://www.djangobook.com/en/2.0/chapter12/ (under "Using Different Settings for Production") and https://code.djangoproject.com/wiki/SplitSettings ...

2 comments

My normal settings structure is as follows:

  * settings/__init__.py
  * settings/base.py
  * settings/development.py
  * settings/staging.py.
  * settings/production.py
  * settings/credentials.py
This allows me to have a base settings file which the others inherit from, and all settings are tracked in git apart from passwords which are stored in credentials.py.

Unlike some other approaches, installed apps are just defined once (in the base), but apps can be added/removed for each environment.

We just posted on how Yipit handles settings: http://tech.yipit.com/2011/11/02/django-settings-what-to-do-...