使用DEBUG = False Server Error 500在Heroku上部署Django应用程序

时间:2017-05-20 22:16:54

标签: django heroku deployment

我有一个部署到Heroku的应用程序。它在本地和Heroku上运行良好,“DEBUG = True”。但是,当我在Heroku上以“DEBUG = False”运行它时,我得到一个服务器错误500,如下所示:

2017-05-20T22:00:26.864342+00:00 heroku[router]: at=info method=GET path="/plans/planslist/" host=app.mysite.com request_id=b9a4de90-4a81-42ff-b936-59aa3d17e02e fwd="50.181.204.79" dyno=web.1 connect=0ms service=443ms status=500 bytes=253 protocol=http
2017-05-20T22:00:27.304092+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=app.mysite.com request_id=b24922e4-974a-45db-8ce0-def179602203 fwd="50.181.204.79" dyno=web.1 connect=1ms service=57ms status=500 bytes=239 protocol=http

我必须设置错误但无法弄明白。任何帮助将不胜感激。我整天都在晒黑这半天而且没有在哪里。

我的settings.py

import os
from django.conf import settings
from .base import *

BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

DEBUG = False
TEMPLATE_DEBUG = False

import dj_database_url
DATABASES = { 'default': dj_database_url.config(conn_max_age=500) }

ALLOWED_HOSTS = ['app.mysite.com']

INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.sites',
    'django.contrib.humanize',
    'bootstrap3',
    'company_account',
    'company_data',
    'plans',
    'django.contrib.admin',
    'registration',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    ]

# Usual Middleware here

WSGI_APPLICATION = 'mywebapp.wsgi.application'

STATIC_URL = '/collectstatic/'
STATIC_ROOT = 'staticfiles'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
    )

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

0 个答案:

没有答案