Home > Software, programming > Django in Production

Django in Production

October 20th, 2009

Here are some quick tips when moving your Django site into production.

Q: How to determine if site is in local or production setup?
A: Create a production.py in your production site.  In your settings.py, add the following lines:

try:
    import production
    PRODUCTION = True
except ImportError:
    PRODUCTION = False

Wherever in your code, you can do the following:

from django.conf import settings
...
if settings.PRODUCTION:
    # code for production...
else:
    # code for local...

Neat eh? ;)

Author: Cyril Pauya Categories: Software, programming Tags: ,
  1. December 6th, 2011 at 10:48 | #1

    which webserver is good for production in Django?

  2. August 29th, 2017 at 23:24 | #2

    Started up to date cobweb predict
    free games free online free mobile apps for android download apk application photo wallpaper sexy porn protection software
    http://games.android.telrock.net/?gain.katerina
    apps download youtube videos edit apk tablet apps store the best dating apps application development company india

  1. No trackbacks yet.