我的
我正在 Heroku 上部署我的 Django 项目,但我不断收到此应用程序错误应用程序中发生错误,无法投放您的页面。如果您是应用程序所有者,请检查日志以了解详细信息。您可以从 Heroku CLI 执行此操作,并在键入 heroku open
后出现命令错误。
崩溃的日志
2019-02-08T05:11:47.595848+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=**.herokuapp.com request_id=754cd442-2b92-4d35-ab73-f6f3f4b47dd2 fwd="144.214.90.65" dyno= connect= service= status=503 bytes= protocol=https
2019-02-08T05:11:48.592697+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=**.herokuapp.com request_id=1dfcc7fa-e278-42be-b02a-0df04c824b57 fwd="144.214.90.65" dyno= connect= service= status=503 bytes= protocol=https
heroku logs --tail
2019-02-08T04:25:27.848612+00:00 app[api]: Release v1 created by user ***@gmail.com
2019-02-08T05:10:08.937759+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-08T05:21:19.195680+00:00 heroku[web.1]: State changed from crashed to starting
2019-02-08T05:27:16.830898+00:00 heroku[web.1]: Starting process with command `gunicorn gettingstarted.wsgi --log-file -`
2019-02-08T05:27:19.380582+00:00 heroku[web.1]: State changed from starting to crashed
2019-02-08T05:27:19.363391+00:00 heroku[web.1]: Process exited with status 3
2019-02-08T05:27:19.253888+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [4] [INFO] Starting gunicorn 19.9.0
2019-02-08T05:27:19.254420+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [4] [INFO] Listening at: http://0.0.0.0:4868 (4)
2019-02-08T05:27:19.254514+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [4] [INFO] Using worker: sync
2019-02-08T05:27:19.258397+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [10] [INFO] Booting worker with pid: 10
2019-02-08T05:27:19.262923+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [10] [ERROR] Exception in worker process
2019-02-08T05:27:19.262927+00:00 app[web.1]: Traceback (most recent call last):
2019-02-08T05:27:19.262929+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-02-08T05:27:19.262931+00:00 app[web.1]: worker.init_process()
2019-02-08T05:27:19.262932+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-02-08T05:27:19.262934+00:00 app[web.1]: self.load_wsgi()
2019-02-08T05:27:19.262936+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-02-08T05:27:19.262937+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-02-08T05:27:19.262939+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-02-08T05:27:19.262941+00:00 app[web.1]: self.callable = self.load()
2019-02-08T05:27:19.262942+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-02-08T05:27:19.262944+00:00 app[web.1]: return self.load_wsgiapp()
2019-02-08T05:27:19.262946+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-02-08T05:27:19.262947+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-02-08T05:27:19.262949+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2019-02-08T05:27:19.262950+00:00 app[web.1]: __import__(module)
2019-02-08T05:27:19.262952+00:00 app[web.1]: ModuleNotFoundError: No module named 'gettingstarted'
2019-02-08T05:27:19.263083+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [10] [INFO] Worker exiting (pid: 10)
2019-02-08T05:27:19.287592+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [4] [INFO] Shutting down: Master
2019-02-08T05:27:19.287748+00:00 app[web.1]: [2019-02-08 05:27:19 +0000] [4] [INFO] Reason: Worker failed to boot.
我的Procfile
web: gunicorn gettingstarted.wsgi --log-file -
settings.py
"""
***
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = [
'**', # subdoamin wildcard
'localhost',
'127.0.0.1',
'144.214.90.65'
]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'product.apps.ProductConfig',
'product',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
***
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# os.path.join(BASE_DIR, 'templates'),],
'DIRS': [BASE_DIR + '/templates/'],
'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 = '***.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/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/2.1/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/2.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'CET' # UTC + 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
# The URL to use when referring to static files (where they will be served from)
STATIC_URL = '/static/'
# The absolute path to the directory where collectstatic will collect static files for deployment.
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# check new places here so I
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_PRELOAD = True
SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = False
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
2019-02-08T05:27:19.262952+00:00 app[web.1]:模块未找到错误:没有名为"gettingstart"的模块
您忘记添加、提交和推送gettingstarted
目录。这是您的Procfile
所必需的。