title: ImportError: Could not import settings 'health_tweets.settings' No module named health_tweets.settings
body: <p>I am deploying the django site with Apache2. When I was trying to execute manage.py, it goes to </p>
  
  <pre><code>ImportError: Could not import settings 'mysite.settings'   No module named mysite.settings
  </code></pre>
  
  <p>This is my project structure:</p>
  
  <pre><code>healthtweets/
  manage.py
      code/
      __init__.py
          health_tweets/
          wsgi.py
          settings.py
          models.py
          __init__.py
  </code></pre>
  
  <p>I was trying to add all possible python paths, this is my wsgi.py:
      import os
      import sys
      from site import addsitedir
      from django.core.handlers.wsgi import WSGIHandler</p>
  
  <pre><code>sys.path.insert(0,'/home/usr/webapps/healthtweets_dev/healthtweets/')
  sys.path.append('/home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets')
  sys.path.append('/home/usr/webapps/healthtweets_dev/healthtweets/code/')
  root = os.path.join(os.path.dirname(__file__), '..')  
  sys.path.insert(0, root)  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'health_tweets.settings'
  #application = django.core.handlers.wsgi.WSGIHandler()
  application = WSGIHandler()
  </code></pre>
  
  <p>And this is the current python path:</p>
  
  <pre><code>['/home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets/..',
   '/home/usr/webapps/healthtweets_dev/healthtweets/',
   '/home/usr/webapps/healthtweets_dev/lib/python2.7/python_memcached-1.48-py2.7.egg',
   '/home/usr/webapps/healthtweets_dev/healthtweets/code',
   '/home/usr/webapps/healthtweets_dev/lib/python2.7',
   '/home/usr/webapps/django/lib/python2.7/python_memcached-1.48-py2.7.egg',
   '/home/usr/lib/python2.7/pymongo-2.3-py2.7-linux-x86_64.egg',
   '/home/usr/lib/python2.7/django_picklefield-0.2.1-py2.7.egg',
   '/home/usr/webapps/django/lib/python2.7/python_memcached-1.48-py2.7.egg',
   '/home/usr/lib/python2.7',
   '/home/usr/webapps/healthtweets_dev/healthtweets/manage.py',
   '/home/usr',
   '/home/usr/webapps/django/lib/python2.7',
   '/usr/local/lib/python27.zip',
   '/usr/local/lib/python2.7',
   '/usr/local/lib/python2.7/plat-linux2',
   '/usr/local/lib/python2.7/lib-tk',
   '/usr/local/lib/python2.7/lib-old',
   '/usr/local/lib/python2.7/lib-dynload',
   '/usr/local/lib/python2.7/site-packages',
   '/usr/local/lib/python2.7/site-packages/PIL',
   '/home/usr/webapps/healthtweets_dev/healthtweets/manage.py',
   '/home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets',
   '/home/usr/webapps/healthtweets_dev/healthtweets/code/']
  </code></pre>
  
  <p>This is the httpd.conf:</p>
  
  <pre><code> ServerRoot "/home/usr/webapps/healthtweets_dev/apache2"
  
   LoadModule dir_module        modules/mod_dir.so
   LoadModule env_module        modules/mod_env.so
   LoadModule log_config_module modules/mod_log_config.so
   LoadModule mime_module       modules/mod_mime.so
   LoadModule rewrite_module    modules/mod_rewrite.so
   LoadModule setenvif_module   modules/mod_setenvif.so
   LoadModule wsgi_module       modules/mod_wsgi.so
  
  
   LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
   CustomLog /home/usr/logs/user/access_healthtweets_dev.log combined
   ErrorLog /home/usr/logs/user/error_healthtweets_dev.log
   KeepAlive Off
   Listen 31846
   MaxSpareThreads 3
   MinSpareThreads 1
   ServerLimit 1
   SetEnvIf X-Forwarded-SSL on HTTPS=1
   ThreadsPerChild 5
   WSGIPythonPath    /home/usr/webapps/healthtweets_dev/healthtweets/code/:/home/usr/webapps/healthtweets_dev/lib/python2.7
   WSGIDaemonProcess healthtweets_dev processes=2 threads=12 python-path= /home/usr/webapps/healthtweets_dev/healthtweets/code/:/home/usr/webapps/healthtweets _dev/lib/python2.7
   WSGIProcessGroup healthtweets_dev
   WSGIRestrictEmbedded On
   WSGILazyInitialization On
   WSGIScriptAlias / /home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets/wsgi.py
  </code></pre>
  
  <p>Beside this, I have also chmod 711 to the project directories. But nothing works.
  Thank you very much!</p>
  
  <p>Edit:
  I tested the paths as described in this post: <a href="https://stackoverflow.com/questions/8052559/how-to-troubleshoot-importerror-could-not-import-settings-mysite-settings-w?rq=1">How to troubleshoot - ImportError: Could not import settings &#39;mysite.settings&#39; when deploying django?</a>
  They have all existed...</p>
  
  <pre><code>&gt;&gt;&gt; os.path.exists('/home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets')
  True
  &gt;&gt;&gt; os.path.exists('/home/usr/webapps/healthtweets_dev/healthtweets/code/health_tweets/settings.py')
  True
  &gt;&gt;&gt; os.path.exists('/home/usr/webapps/healthtweets_dev/healthtweets/code/')
  True
  &gt;&gt;&gt; os.path.exists('/home/usr/webapps/healthtweets_dev/healthtweets/')
  True
  &gt;&gt;&gt; os.path.exists('/home/usr/webapps/healthtweets_dev/')
  True
  </code></pre>
  
  <p>But the final test is not passed:</p>
  
  <pre><code>&gt;&gt;&gt; import health_tweets.settings
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
      ImportError: No module named health_tweets.settings
  </code></pre>