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:

    import production
except ImportError:
    PRODUCTION = False

Wherever in your code, you can do the following:

from django.conf import settings
if settings.PRODUCTION:
    # code for production...
    # 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?

  1. No trackbacks yet.