-1

I have a project that may be started on local machine with ./manage.py runserver and on the remote server with uwsgi. I have two settings files: settings (for local machine) and prod_settings. So when I start project with uwsgi I simply use this option

env = DJANGO_SETTINGS_MODULE=prod_settings

But sometimes I have to know what module is currently active. I can check DJANGO_SETTINGS_MODULE key but think that it is not the True way. Tried to google something but found nothing yet.

Thanks for your advices.

alexvassel
  • 10,600
  • 2
  • 29
  • 31
  • do you really need to know which settings module is active? or do you actually need to know if you're running production or local? if the latter then maybe just set a flag or use the sites framework. – scytale Jul 05 '12 at 11:28
  • I really should know the module – alexvassel Jul 05 '12 at 13:00

1 Answers1

1

in your settings files:

import os
SETTINGS_MODULE = os.path.abspath(__file__)

(or whatever you want)

but if it's just for debugging, that's not that much of an improvement wrt/ reading env["DJANGO_SETTINGS_MODULE"].

bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118