当我运行“heroku open”时,页面会显示
Application error
An error occurred in the application and your page could not be served. Please try again in a few moments
If you are the application owner, check your logs for details
我检查了我的heroku日志,紫色似乎有一些错误
2016-03-30T12:46:00.756708+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=alto-vera.herokuapp.com request_id=918f4847- 622a-42b8-8ffd-e7045ce7f987 fwd="67.86.106.244" dyno= connect= service= status=503 bytes=
2016-03-30T12:46:01.307777+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=alto-vera.herokuapp.com request_id=88779897-4ddc-437c-9d8b-e9378dee3c09 fwd="67.86.106.244" dyno= connect= service= status=503 bytes=
我只知道说应用程序崩溃超出了我不知道的程度。如果有人可以提供指导我会很感激
修改
requirements.txt
dj-database-url==0.4.0
Django==1.9.4
gunicorn==19.4.5
beautifulsoup4==4.4.1
django-crispy-forms==1.6.0
django-haystack==2.4.1
django-taggit==0.18.0
Pillow==3.1.1
psycopg2==2.6.1
pysolr==3.4.0
pytz==2016.1
requests==2.9.1
whitenoise==3.0
Procfile
web: gunicorn mysite.wsgi --log-file -
settings.py
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import dj_database_url
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3iiooiiiooiijju&(mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mysite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
WSGI
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
我刚注意到的错误消息
ImportError: No module named mysite.wsgi
和
2016-03-30T13:18:32.819542+00:00 app[web.1]: [2016-03-30 13:18:32 +0000] [9] [INFO] Worker exiting (pid: 9)
2016-03-30T13:18:32.843958+00:00 app[web.1]: [2016-03-30 13:18:32 +0000] [3] [INFO] Shutting down: Master
2016-03-30T13:18:32.844225+00:00 app[web.1]: [2016-03-30 13:18:32 +0000] [3] [INFO] Reason: Worker failed to boot.
我的目录
mysite\
mysite\
static\
staticfiles\
__init__.py
settings.py
urls.py
wsgi.py
db.sqlite
manage.py
Procfile
requirements.txt