title: django deploy- ImproperlyConfigured: The SECRET_KEY setting must not be empty
body: <p>The project worked fine on windows pycharm.</p>
  
  <p>Now i am putting it on ubuntu14.04 and apache2.</p>
  
  <p>When i run <code>python manage.py runserver 8000</code></p>
  
  <pre><code>Traceback (most recent call last):   File "manage.py", line 14, in &lt;module&gt;
      execute_from_command_line(sys.argv)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/management/__init__.py", line 350, in execute_from_command_line
      utility.execute()   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/management/__init__.py", line 342, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/management/__init__.py", line 195, in fetch_command
      klass = load_command_class(app_name, subcommand)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/management/__init__.py", line 39, in load_command_class
      module = import_module('%s.management.commands.%s' % (app_name, name))   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
      __import__(name)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/management/commands/runserver.py", line 16, in &lt;module&gt;
      from django.db.migrations.executor import MigrationExecutor   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/migrations/executor.py", line 7, in &lt;module&gt;
      from .loader import MigrationLoader   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/migrations/loader.py", line 10, in &lt;module&gt;
      from django.db.migrations.recorder import MigrationRecorder   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/migrations/recorder.py", line 12, in &lt;module&gt;
      class MigrationRecorder(object):   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/migrations/recorder.py", line 26, in MigrationRecorder
      class Migration(models.Model):   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/migrations/recorder.py", line 27, in Migration
      app = models.CharField(max_length=255)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/models/fields/__init__.py", line 1072, in __init__
      super(CharField, self).__init__(*args, **kwargs)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/db/models/fields/__init__.py", line 166, in __init__
      self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 55, in __getattr__
      self._setup(name)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 43, in _setup
      self._wrapped = Settings(settings_module)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 99, in __init__
      mod = importlib.import_module(self.SETTINGS_MODULE)   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
      __import__(name)   File "/var/www/Web-Interaction-APP/settings.py", line 8, in &lt;module&gt;
      application = get_wsgi_application()   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/core/wsgi.py", line 13, in get_wsgi_application
      django.setup()   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/__init__.py", line 17, in setup
      configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 55, in __getattr__
      self._setup(name)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 43, in _setup
      self._wrapped = Settings(settings_module)   File "/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg/django/conf/__init__.py", line 120, in __init__
      raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
  </code></pre>
  
  <p>I have also tried to change my <code>manage.py</code> and <code>wsgi.py</code>. My folder is:</p>
  
  <pre><code>Web-Interaction-APP
  
  -manage.py  
  
  -seetings.py
  
  *apache(folder)
  
         -wsgi.py
  
   *project(folder)
  </code></pre>
  
  <p>in my manage.py:</p>
  
  <pre><code>#!/usr/bin/env python
  #This file runs the server for this application from command line.
  import os, sys
  
  #Executes the code in the following condition if the program is run directly. 
  #(Source: http://stackoverflow.com/questions/419163/what-does-if-name-main-do)
  if __name__ == "__main__":
      #Refers to the path of this django project's settings module.
      #(DJANGO_SETTINGS_MODULE is an environment variable to module import path.)
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
  
      from django.core.management import execute_from_command_line
      #Executes the django project.
      execute_from_command_line(sys.argv)
  </code></pre>
  
  <p>In my wsgi.py:</p>
  
  <pre><code>import os, sys
  # Calculate the path based on the location of the WSGI script.
  apache_configuration= os.path.dirname(__file__)
  project = os.path.dirname(apache_configuration)
  workspace = os.path.dirname(project)
  sys.path.append(workspace)
  sys.path.append(project)
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Web-Interaction-APP.settings")
  
  
  # Add the path to 3rd party django application and to django itself.
  sys.path.append('/home/zhaojf1')
  os.environ['DJANGO_SETTINGS_MODULE'] = '10.231.52.XX.apache.override'
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>