title: Set DJANGO_SETTINGS_MODULE as an Environment Variable in Windows permanently
body: <p>How can I permanently set the environmental variable <code>DJANGO_SETTINGS_MODULE</code> on <code>WINDOWS</code> on a permanent basis and be done with it?</p>
  
  <p>I mean</p>
  
  <ol>
  <li><code>Win Button</code> + <code>Pause/Break Button</code></li>
  <li>This leads to <code>Control Panel\System and Security\System</code></li>
  <li>Click <code>Advanced System Settings</code></li>
  <li>Click <code>Environment Variables</code></li>
  <li>There are two boxes the first is titled <code>User variables</code> and the second <code>System variables</code></li>
  <li>On the <code>System variables</code> click the <code>New Button</code></li>
  <li>For variable name put in <code>DJANGO_IMPORT_SETTINGS</code></li>
  </ol>
  
  <p><strong>XXX--></strong> <strong>WHAT DO I PUT IN VARIABLE VALUE TO SET IT ONCE AND FOR ALL?</strong></p>
  
  <hr>
  
  <p>In the Django Site on this <a href="https://docs.djangoproject.com/en/dev/topics/settings/" rel="nofollow noreferrer">issue</a> it states:</p>
  
  <p><em>DJANGO_SETTINGS_MODULE</em></p>
  
  <p><em>When you use Django, you have to tell it which settings you’re using. Do this by using an environment variable, DJANGO_SETTINGS_MODULE.</em></p>
  
  <p><em>The value of DJANGO_SETTINGS_MODULE should be in Python path syntax,e.g. mysite.settings. Note that the settings module should be on the Python import search path.</em></p>
  
  <hr>
  
  <p>What does it mean <strong><em>...should be in Python path syntax e.g. mysite.settings...</em></strong> ?</p>
  
  <ul>
  <li>I have a certain directory where my <code>Python</code> is located:
  <code>C:\Python27</code> </li>
  <li>I have a certain directory where my <code>Django</code> is located: <code>C:\Python27\Lib\site-packages\django</code></li>
  </ul>
  
  <p>What does this <code>mysite</code> means. What directory is it meanning <code>C:\Something......</code></p>
  
  <p>Can you put this variable once and for all or you have to constantly change it for every project (I hope not!)</p>
  
  <p>And what does this suspiciously line means <strong><em>Note that the settings module should be on the Python import search path.</em></strong></p>
  
  <p><strong>All I want it to set the DJANGO_SETTINGS_MODULE environmental variable and be done once and for all from this hassle</strong></p>
  
  <p><strong>EDIT</strong></p>
  
  <p><em>In order to work, Django just has to be pointed at a valid settings file, and by default it
  looks for an environment variable named DJANGO_SETTINGS_MODULE to tell it where to find the
  settings. The value of this variable should be the Python import path of the settings file, such
  as cms.settings.</em></p>
  
  <p>--> What king of directory is this: <code>cms.settings</code>? In windows every directory starts with a hard drive as <strong>C:\Something.....</strong>. How can you start a directory like this in Windows?</p>
  
  <p><strong>EDIT_2</strong></p>
  
  <p>Excerpt from a book</p>
  
  <p><em>PROBLEM</em>
  <em>Environment variable DJANGO_SETTINGS_MODULE is undefined.</em></p>
  
  <p><em>SOLUTION</em>
  <em>Run the command <code>python manage.py shell</code> rather than <code>python</code>.</em></p>
  
  <p><strong>MY QUESTION</strong> --> ON WHAT DIRECTORY?///CAN YOU SET IT FOR ONCE OR IS IT DIFFERENT PER PROJECT?</p>
  
  <p>MY PROJECT IS STRUCTURED LIKE THIS</p>
  
  <pre><code>C:\Python27\pysec-master(file)
  |__local_settings.py
  |__manage.py
  |__settings.py
  |__C:\Python27\pysec(file)
     |__ __init__.py
     |__example.py
     |__models.py
     |__xbrl.py
     |__xbrl_fundamentals.py
  </code></pre>
  
  <p>I am trying to run <code>models.py</code> and I have a <code>settings.py</code> in the <code>C:\Python27\pysec-master</code>
  You can find an exact copy <a href="https://github.com/lukerosiak/pysec" rel="nofollow noreferrer">here</a>.</p>
  
  <p><strong>MAYBE_IMPORTANT_EDIT</strong></p>
  
  <p>I have a file called <code>manage.py</code> in my project which has these contents</p>
  
  <pre><code>#!/usr/bin/env python
  import os
  import sys
  
  if __name__ == "__main__":
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
  
      from django.core.management import execute_from_command_line
  
      execute_from_command_line(sys.argv)
  </code></pre>
  
  <p>Does this has to do anything on setting the variable? Do I need to set here here inside the loop?</p>
  
  <p>EDIT</p>
  
  <p>For the command in the IDLE <code>from django.db import settings</code> do i need to set a directory for the <code>PYTHON_MODULE_SETTINGS</code> like <code>C:\Python27\Lib\site-packages\django\db</code> ?</p>