How can I tell whether my Django application is running on development server or not?

I put the following in my settings.py to distinguish between the standard dev server and production:

import sys
RUNNING_DEVSERVER = (len(sys.argv) > 1 and sys.argv[1] == 'runserver')

This also relies on convention, however.

(Amended per Daniel Magnusson’s comment)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)