title: Django, uwsgi and nginx - Internal Server Error
body: <p>I am quite new to python and am working on my first django project. I followed <a href="http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html" rel="noreferrer">this</a> tutorial. I managed to configure all the things but django app itself. It works if I run django server alone, however it does not work when started by uwsgi.</p>
  
  <p>This is my uwsgi conf:</p>
  
  <pre><code>import os
  
  from django.core.wsgi import get_wsgi_application
  
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings")
  
  application = get_wsgi_application()
  </code></pre>
  
  <p>And error from uwsgi log:</p>
  
  <pre><code>--- no python application found, check your startup logs for errors ---
  </code></pre>
  
  <p>So I looked up for startup errors:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./wsgi.py", line 16, in &lt;module&gt;
      application = get_wsgi_application()
    File "/var/www/api.partycon.net/virtualpy/local/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
      django.setup()
    File "/var/www/api.partycon.net/virtualpy/local/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
      configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
    File "/var/www/api.partycon.net/virtualpy/local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
      self._setup(name)
    File "/var/www/api.partycon.net/virtualpy/local/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
      self._wrapped = Settings(settings_module)
    File "/var/www/api.partycon.net/virtualpy/local/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
      mod = importlib.import_module(self.SETTINGS_MODULE)
    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
      __import__(name)
  ImportError: No module named api.settings
  </code></pre>
  
  <p>My project's dirtree:</p>
  
  <pre><code>.
  |-- api
  |   |-- __init__.py
  |   |-- __init__.pyc
  |   |-- media
  |   |   `-- sample-media.jpg
  |   |-- settings.py
  |   |-- settings.pyc
  |   |-- urls.py
  |   |-- urls.pyc
  |   |-- wsgi.py
  |   `-- wsgi.pyc
  |-- db.sqlite3
  |-- manage.py
  |-- static
  |   `-- admin
  |       ... ... ... ...
  |-- uwsgi_conf.ini
  `-- uwsgi_params
  </code></pre>
  
  <p>I hope I provided enough information, however I can tell u more - the problem is that I actually have no idea where to look.</p>
  
  <p>Thanks in advance :)</p>