Heroku - No module named wsgi

Viewed 41299

I followed the getting started Django guide on the Heroku support center but I am getting the following error when I try to start it on either Heroku or with foreman:

ImportError: No module named wsgi

Here is my procfile:

web: gunicorn testproject.wsgi -b 0.0.0.0:$PORT

Here is my django project settings file:

from datetime import date, timedelta
import os
oneyr = date.today() + timedelta(days=365)
PROJECT_DIR = os.path.dirname(__file__)

DEBUG = os.environ.get('DEBUG')
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

TIME_ZONE = 'Europe/London'
LANGUAGE_CODE = 'en-gb'
USE_I18N = False
USE_L10N = True

MEDIA_ROOT = os.path.join(PROJECT_DIR, 'static/')
MEDIA_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(PROJECT_DIR, 'static/'),
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'testproject.urls'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_DIR, 'templates')
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'gunicorn',
    'storages',
)

STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

Does anyone have any idea why this app won't start?

6 Answers

I had this error as well, and the other solutions did not fix it. The source of my problem was that I had installed gunicorn through apt-get. To solve, I removed gunicorn via apt and ran pip install gunicorn.

Related