gunicorn "configuration cannot be imported"
<p>I'm migrating a project that has been on Heroku to a DO droplet. Install went smoothly, and everything is working well when I <code>python manage.py runserver 0.0.0.0:8000</code>.</p>

<p>I'm now setting up gunicorn using these instructions:
<a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04" rel="nofollow">https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04</a></p>

<p>I activate the virtual environment, and then try <code>--bind 0.0.0.0:3666 myproject.wsgi:application</code>. I get the following error:</p>

<pre><code>Traceback (most recent call last):
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
    __import__(module)
  File "/var/www/myproject/myproject/wsgi.py", line 6, in &lt;module&gt;
    from configurations.wsgi import get_wsgi_application
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/configurations/wsgi.py", line 3, in &lt;module&gt;
    importer.install()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/configurations/importer.py", line 54, in install
    importer = ConfigurationImporter(check_options=check_options)
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/configurations/importer.py", line 73, in __init__
    self.validate()
  File "/var/www/myproject/venv/local/lib/python2.7/site-packages/configurations/importer.py", line 122, in validate
    raise ImproperlyConfigured(self.error_msg.format(self.namevar))
ImproperlyConfigured: Configuration cannot be imported, environment variable DJANGO_CONFIGURATION is undefined.
</code></pre>

<p>My <code>wsgi.py</code> looks like this:</p>

<pre><code># -*- coding: utf-8 -*-

import os

from configurations.wsgi import get_wsgi_application

application = get_wsgi_application()
</code></pre>

<p>I didn't set up the project initially, so I'm not sure what is different, or where to look.</p>

<p>Use this link and Set the DJANGO_CONFIGURATION environment variable to the name of the class you just created, e.g. in bash:</p>

<p>export DJANGO_CONFIGURATION=Dev  </p>

<p><a href="https://github.com/jazzband/django-configurations" rel="nofollow">Read further here.</a></p>

<p><a href="https://django-configurations.readthedocs.io/en/stable/" rel="nofollow">And/or here.</a></p>

python django gunicorn