Best way to define Django global variable on apache starup
<p>I have some configuration in a json file and on the database and I want to load those configuration on Django startup (Apache server startup).. I will be using those global variable within all the application. 
For Example: External server connection api or number of instances. </p>

<p>What is the best way to define the global variables. I want to load the json file when server starts and use the variable value util server stop. ?</p>

<p>It sounds like the thing you're probably looking for is <code>environment variables</code> - you can always use a small script to set the environment variables from the JSON that you have at present. </p>

<p>Setting these in your .bashrc file or, more preferably a virtualenv will let you:</p>

<ol>
<li>Take sensitive settings, like <code>SECRET_KEY</code> <a href="https://docs.djangoproject.com/en/1.10/topics/settings/" rel="nofollow">out of version control.</a> </li>
<li>Offer database settings, either by supplying them as a DB URL or as seperate environment variables.</li>
<li>Set both Django settings and other useful variables outside of the immediate Django project. </li>
</ol>

<p>The <a href="https://django-environ.readthedocs.io/en/latest/" rel="nofollow">django-environ docs have a useful tutorial</a> on how to set it up.   <a href="https://github.com/pydanny/cookiecutter-django" rel="nofollow">The Django Cookie-Cutter project</a> makes extensive use of Environment Variables (including DB and mailserver settings), and is a great place to pick up hints and approaches.</p>

python django