pkdkk
pkdkk

Reputation: 3961

Django set "debug" mode depending on URL

Does anyone know a good way to handle the debug mode dynamically in Django - settings.py ? ..

I want the debug mode to be true if the requested is eg. test.mydomain.com

and when i go to mydomain.com the debug mode is false.

Is there a way to get the requested URL in the settings.py file to make a IF condition?

Upvotes: 1

Views: 232

Answers (1)

doniyor
doniyor

Reputation: 37904

django's settings should stay immutable. it is supposed to be so.

you better create two settings,

  1. settings.py, (which is already there)
  2. debug_settings.py with DEBUG=True

and create two wsgi's in your django.

  1. wsgi.py (which is already there) which refers to settings.py
  2. wsgi_debug.py which refers to debug_settings.py

and in your apache config, depending on servername, make it refer to respective wsgi.

Upvotes: 4

Related Questions