django - Using Constants in Settings.py -


Do I declare a variable in the settings.py of the Django project in one of my module files? I can use

For example, using DATABASE_HOST = 'databasename' ?

I am trying to get the name of the server on which the application is currently posted on you.

You can of course ... it can be encouraged, to actually use it , Import settings from django.conf (this imports the settings of your project):

print "My database host is% s"% settings.DATABASE_HOST

This document explains why this works, and why the settings.py module is better than importing directly.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -