title: Create constants using a "settings" module?
body: <p>I am relatively new to Python. I am looking to create a "settings" module where various application-specific constants will be stored.</p>
  
  <p>Here is how I am wanting to set up my code:</p>
  
  <p>settings.py</p>
  
  <pre><code>CONSTANT = 'value'
  </code></pre>
  
  <p>script.py</p>
  
  <pre><code>import settings
  
  def func():
      var = CONSTANT
      # do some more coding
      return var
  </code></pre>
  
  <p>I am getting a Python error stating: </p>
  
  <blockquote>
    <p><code>global name 'CONSTANT' is not defined.</code></p>
  </blockquote>
  
  <p>I have noticed on Django's source code their <code>settings.py</code> file has constants named just like I do. I am confused on how they can be imported to a script and referenced through the application.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thank you for all your answers! I tried the following:</p>
  
  <pre><code>import settings
  
  print settings.CONSTANT
  </code></pre>
  
  <p>I get the same error</p>
  
  <blockquote>
    <p><code>ImportError: cannot import name CONSTANT</code></p>
  </blockquote>