使用Django问题部署到Heroku

时间:2015-07-20 17:37:21

标签: python django heroku gunicorn

我认为我接近部署我的应用程序,但我一直遇到同样的问题而且我很难解释我的heroku日志。

setting.py

import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
ACTUAL_DIR = os.path.dirname(__file__)
TEMPLATE_PATH = os.path.join(ACTUAL_DIR, 'templates')
STATIC_PATH = os.path.join(ACTUAL_DIR, 'static')


SECRET_KEY = 'mykey'


DEBUG = False

TEMPLATE_DEBUG = True

TEMPLATE_DIRS = (

    TEMPLATE_PATH,
)

ALLOWED_HOSTS = ['*']


SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'GingerBites',
)

MIDDLEWARE_CLASSES = (
    '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 = 'GingerEats.urls'

WSGI_APPLICATION = 'GingerEats.wsgi.application'



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


LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/Los_Angeles'

USE_I18N = True

USE_L10N = True

USE_TZ = True



import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

Procfile

web: gunicorn GingerEats.wsgi --timeout 400 --keep-alive 5 --log-level debug

我在这里部署的是我的日志:

2015-07-20T17:21:43.376954+00:00 heroku[web.1]: Process exited with status 3
2015-07-20T17:21:44.250032+00:00 heroku[web.1]: State changed from up to crashed
2015-07-20T17:27:28.288695+00:00 heroku[api]: Deploy 856baa7 by me@gmail.com
2015-07-20T17:27:28.288695+00:00 heroku[api]: Release v31 created by me@gmail.com
2015-07-20T17:27:28.352091+00:00 heroku[slug-compiler]: Slug compilation started
2015-07-20T17:27:28.352112+00:00 heroku[slug-compiler]: Slug compilation finished
2015-07-20T17:27:28.376430+00:00 heroku[web.1]: State changed from crashed to starting
2015-07-20T17:27:33.298786+00:00 heroku[web.1]: Starting process with command `gunicorn GingerEats.wsgi --timeout 120 --keep-alive 5 --log-level debug`
2015-07-20T17:27:35.422677+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [DEBUG] Current configuration:
2015-07-20T17:27:35.422702+00:00 app[web.1]:   when_ready: <function when_ready at 0x7fa066a2fe60>
2015-07-20T17:27:35.422705+00:00 app[web.1]:   default_proc_name: GingerEats.wsgi
2015-07-20T17:27:35.422706+00:00 app[web.1]:   limit_request_field_size: 8190
2015-07-20T17:27:35.422707+00:00 app[web.1]:   worker_abort: <function worker_abort at 0x7fa066a385f0>
2015-07-20T17:27:35.422709+00:00 app[web.1]:   logconfig: None
2015-07-20T17:27:35.422710+00:00 app[web.1]:   keyfile: None
2015-07-20T17:27:35.422711+00:00 app[web.1]:   statsd_prefix: 
2015-07-20T17:27:35.422714+00:00 app[web.1]:   pre_exec: <function pre_exec at 0x7fa066a38758>
2015-07-20T17:27:35.422713+00:00 app[web.1]:   pre_fork: <function pre_fork at 0x7fa066a38050>
2015-07-20T17:27:35.422715+00:00 app[web.1]:   django_settings: None
2015-07-20T17:27:35.422717+00:00 app[web.1]:   keepalive: 5
2015-07-20T17:27:35.422718+00:00 app[web.1]:   accesslog: None
2015-07-20T17:27:35.422719+00:00 app[web.1]:   worker_int: <function worker_int at 0x7fa066a38488>
2015-07-20T17:27:35.422720+00:00 app[web.1]:   reload: False
2015-07-20T17:27:35.422722+00:00 app[web.1]:   pidfile: None
2015-07-20T17:27:35.422723+00:00 app[web.1]:   worker_tmp_dir: None
2015-07-20T17:27:35.422724+00:00 app[web.1]:   syslog: False
2015-07-20T17:27:35.422725+00:00 app[web.1]:   raw_env: []
2015-07-20T17:27:35.422726+00:00 app[web.1]:   syslog_facility: user
2015-07-20T17:27:35.422728+00:00 app[web.1]:   ciphers: TLSv1
2015-07-20T17:27:35.422729+00:00 app[web.1]:   max_requests_jitter: 0
2015-07-20T17:27:35.422730+00:00 app[web.1]:   post_fork: <function post_fork at 0x7fa066a381b8>
2015-07-20T17:27:35.422732+00:00 app[web.1]:   access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
2015-07-20T17:27:35.422733+00:00 app[web.1]:   worker_connections: 1000
2015-07-20T17:27:35.422734+00:00 app[web.1]:   cert_reqs: 0
2015-07-20T17:27:35.422735+00:00 app[web.1]:   syslog_prefix: None
2015-07-20T17:27:35.422736+00:00 app[web.1]:   proc_name: None
2015-07-20T17:27:35.422738+00:00 app[web.1]:   check_config: False
2015-07-20T17:27:35.422739+00:00 app[web.1]:   enable_stdio_inheritance: False
2015-07-20T17:27:35.422740+00:00 app[web.1]:   user: 37026
2015-07-20T17:27:35.424053+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [DEBUG] Arbiter booted
2015-07-20T17:27:35.422741+00:00 app[web.1]:   certfile: None
2015-07-20T17:27:35.422743+00:00 app[web.1]:   chdir: /app
2015-07-20T17:27:35.422744+00:00 app[web.1]:   umask: 0
2015-07-20T17:27:35.485991+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [10] [INFO] Booting worker with pid: 10
2015-07-20T17:27:35.422745+00:00 app[web.1]:   tmp_upload_dir: None
2015-07-20T17:27:35.422746+00:00 app[web.1]:   pre_request: <function pre_request at 0x7fa066a388c0>
2015-07-20T17:27:35.422747+00:00 app[web.1]:   workers: 2
2015-07-20T17:27:35.422750+00:00 app[web.1]:   forwarded_allow_ips: ['127.0.0.1']
2015-07-20T17:27:35.422749+00:00 app[web.1]:   graceful_timeout: 30
2015-07-20T17:27:35.422751+00:00 app[web.1]:   worker_class: sync
2015-07-20T17:27:35.422752+00:00 app[web.1]:   preload_app: False
2015-07-20T17:27:35.422753+00:00 app[web.1]:   sendfile: True
2015-07-20T17:27:35.422755+00:00 app[web.1]:   secure_scheme_headers: {'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-SSL': 'on'}
2015-07-20T17:27:35.422758+00:00 app[web.1]:   on_starting: <function on_starting at 0x7fa066a2fb90>
2015-07-20T17:27:35.422756+00:00 app[web.1]:   paste: None
2015-07-20T17:27:35.422759+00:00 app[web.1]:   proxy_protocol: False
2015-07-20T17:27:35.422760+00:00 app[web.1]:   proxy_allow_ips: ['127.0.0.1']
2015-07-20T17:27:35.422761+00:00 app[web.1]:   errorlog: -
2015-07-20T17:27:35.422762+00:00 app[web.1]:   loglevel: debug
2015-07-20T17:27:35.422764+00:00 app[web.1]:   limit_request_line: 4094
2015-07-20T17:27:35.422766+00:00 app[web.1]:   threads: 1
2015-07-20T17:27:35.422765+00:00 app[web.1]:   do_handshake_on_connect: False
2015-07-20T17:27:35.422767+00:00 app[web.1]:   max_requests: 0
2015-07-20T17:27:35.422768+00:00 app[web.1]:   timeout: 120
2015-07-20T17:27:35.422769+00:00 app[web.1]:   limit_request_fields: 100
2015-07-20T17:27:35.422771+00:00 app[web.1]:   statsd_host: None
2015-07-20T17:27:35.422772+00:00 app[web.1]:   backlog: 2048
2015-07-20T17:27:35.422773+00:00 app[web.1]:   group: 37026
2015-07-20T17:27:35.422775+00:00 app[web.1]:   suppress_ragged_eofs: True
2015-07-20T17:27:35.422778+00:00 app[web.1]:   spew: False
2015-07-20T17:27:35.422774+00:00 app[web.1]:   ca_certs: None
2015-07-20T17:27:35.422777+00:00 app[web.1]:   bind: ['0.0.0.0:45510']
2015-07-20T17:27:35.422781+00:00 app[web.1]:   post_worker_init: <function post_worker_init at 0x7fa066a38320>
2015-07-20T17:27:35.422779+00:00 app[web.1]:   on_reload: <function on_reload at 0x7fa066a2fcf8>
2015-07-20T17:27:35.422782+00:00 app[web.1]:   post_request: <function post_request at 0x7fa066a389b0>
2015-07-20T17:27:35.422783+00:00 app[web.1]:   worker_exit: <function worker_exit at 0x7fa066a38b18>
2015-07-20T17:27:35.422785+00:00 app[web.1]:   nworkers_changed: <function nworkers_changed at 0x7fa066a38c80>
2015-07-20T17:27:35.422786+00:00 app[web.1]:   on_exit: <function on_exit at 0x7fa066a38de8>
2015-07-20T17:27:35.422788+00:00 app[web.1]:   daemon: False
2015-07-20T17:27:35.422787+00:00 app[web.1]:   logger_class: gunicorn.glogging.Logger
2015-07-20T17:27:35.422789+00:00 app[web.1]:   pythonpath: None
2015-07-20T17:27:35.422791+00:00 app[web.1]:   ssl_version: 3
2015-07-20T17:27:35.422793+00:00 app[web.1]:   config: None
2015-07-20T17:27:35.422792+00:00 app[web.1]:   syslog_addr: udp://localhost:514
2015-07-20T17:27:35.424146+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [INFO] Listening at: http://0.0.0.0:45510 (3)
2015-07-20T17:27:35.423206+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [INFO] Starting gunicorn 19.3.0
2015-07-20T17:27:35.424238+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [INFO] Using worker: sync
2015-07-20T17:27:35.435458+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [9] [INFO] Booting worker with pid: 9
2015-07-20T17:27:35.569800+00:00 app[web.1]: [2015-07-20 17:27:35 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:36.010909+00:00 heroku[web.1]: State changed from starting to up
2015-07-20T17:27:36.156890+00:00 app[web.1]: [2015-07-20 10:27:36 +0000] [10] [DEBUG] Closing connection. 
2015-07-20T17:27:36.156606+00:00 app[web.1]: [2015-07-20 10:27:36 +0000] [9] [DEBUG] Closing connection. 
2015-07-20T17:27:36.571180+00:00 app[web.1]: [2015-07-20 17:27:36 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:37.341165+00:00 app[web.1]: [2015-07-20 10:27:37 +0000] [10] [DEBUG] GET /
2015-07-20T17:27:37.572063+00:00 app[web.1]: [2015-07-20 17:27:37 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:37.691536+00:00 heroku[router]: at=info method=GET path="/" host=young-river-3159.herokuapp.com request_id=7a8be5ab-e590-439a-be61-5eb22c2cd137 fwd="73.189.127.134" dyno=web.1 connect=1ms service=360ms status=500 bytes=239
2015-07-20T17:27:38.573589+00:00 app[web.1]: [2015-07-20 17:27:38 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:39.575002+00:00 app[web.1]: [2015-07-20 17:27:39 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:40.576164+00:00 app[web.1]: [2015-07-20 17:27:40 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:41.577508+00:00 app[web.1]: [2015-07-20 17:27:41 +0000] [3] [DEBUG] 2 workers
2015-07-20T17:27:42.578937+00:00 app[web.1]: [2015-07-20 17:27:42 +0000] [3] [DEBUG] 2 workers

我的网页结果是服务器错误(500)。有人可以帮忙吗?

0 个答案:

没有答案