我按照 Heroku 支持中心上的 Django 入门指南进行操作,但是当我尝试在 Heroku 或工头上启动它时出现以下错误:
ImportError: No module named wsgi
这是我的过程文件:
web: gunicorn testproject.wsgi -b 0.0.0.0:$PORT
这是我的 django 项目设置文件:
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'
有谁知道为什么这个应用程序无法启动?