I'm having issues trying to deploy a Django app using Heroku (ie. I recieve Server Error 500). I have no clue where to start debugging as according to the logs the problem is default code and not the code I've written. Hopefully an extra pair of eyes can help.
2015-08-27T20:39:31.670018+00:00 app[web.1]: django.setup()
2015-08-27T20:39:31.670012+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
2015-08-27T20:39:31.670020+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-08-27T20:39:31.670022+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-08-27T20:39:31.670019+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-08-27T20:39:31.670024+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
2015-08-27T20:39:31.670023+00:00 app[web.1]: self._setup(name)
2015-08-27T20:39:31.670042+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2015-08-27T20:39:31.670051+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
2015-08-27T20:39:31.670052+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2015-08-27T20:39:31.670053+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 30, in import_module
2015-08-27T20:39:31.670054+00:00 app[web.1]: raise TypeError("relative imports require the 'package' argument")
2015-08-27T20:39:31.670055+00:00 app[web.1]: TypeError: relative imports require the 'package' argument
2015-08-27T20:39:31.670056+00:00 app[web.1]: Traceback (most recent call last):
2015-08-27T20:39:31.670057+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
2015-08-27T20:39:31.670058+00:00 app[web.1]: worker.init_process()
2015-08-27T20:39:31.670059+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 114, in init_process
2015-08-27T20:39:31.670061+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2015-08-27T20:39:31.670062+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi
2015-08-27T20:39:31.670064+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-08-27T20:39:31.670063+00:00 app[web.1]: self.callable = self.load()
2015-08-27T20:39:31.670066+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-08-27T20:39:31.670067+00:00 app[web.1]: return util.import_app(self.app_uri)
2015-08-27T20:39:31.670068+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
2015-08-27T20:39:31.670069+00:00 app[web.1]: __import__(module)
2015-08-27T20:39:31.670070+00:00 app[web.1]: File "/app/resume_app/wsgi.py", line 32, in <module>
2015-08-27T20:39:31.670071+00:00 app[web.1]: application = Cling(get_wsgi_application())
2015-08-27T20:39:31.670072+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2015-08-27T20:39:31.670065+00:00 app[web.1]: return self.load_wsgiapp()
2015-08-27T20:39:31.670076+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-08-27T20:39:31.670077+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-08-27T20:39:31.670078+00:00 app[web.1]: self._setup(name)
2015-08-27T20:39:31.670074+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-08-27T20:39:31.670073+00:00 app[web.1]: django.setup()
2015-08-27T20:39:31.670079+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
2015-08-27T20:39:31.670084+00:00 app[web.1]: raise TypeError("relative imports require the 'package' argument")
2015-08-27T20:39:31.670080+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2015-08-27T20:39:31.670081+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
2015-08-27T20:39:31.670082+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2015-08-27T20:39:31.670083+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 30, in import_module
2015-08-27T20:39:31.670085+00:00 app[web.1]: TypeError: relative imports require the 'package' argument
2015-08-27T20:39:31.670092+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [10] [INFO] Worker exiting (pid: 10)
2015-08-27T20:39:31.703669+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [3] [INFO] Shutting down: Master
2015-08-27T20:39:31.703754+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [3] [INFO] Reason: Worker failed to boot.
2015-08-27T20:39:32.422322+00:00 heroku[web.1]: Process exited with status 3
2015-08-27T20:39:32.432936+00:00 heroku[web.1]: State changed from up to crashed
2015-08-27T20:44:13.794339+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stormy-depths-4606.herokuapp.com request_id=934e2666-44a5-46f2-b61b-441943034457 fwd="204.209.24.2" dyno= connect= service= status=503 bytes=
2015-08-27T20:46:23.349023+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-27T20:46:23.349046+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-27T20:46:23.295469+00:00 heroku[api]: Deploy 7dd6665 by MYEMAIL
2015-08-27T20:46:23.295570+00:00 heroku[api]: Release v20 created by MYEMAIL
2015-08-27T20:46:23.821752+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-27T20:46:29.236851+00:00 heroku[web.1]: Starting process with command `gunicorn resume_app.wsgi --log-file -`
2015-08-27T20:46:31.888340+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Starting gunicorn 19.1.1
2015-08-27T20:46:31.889532+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Using worker: sync
2015-08-27T20:46:31.979799+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [10] [INFO] Booting worker with pid: 10
2015-08-27T20:46:31.902030+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [9] [INFO] Booting worker with pid: 9
2015-08-27T20:46:31.889028+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Listening at: http://0.0.0.0:25282 (3)
2015-08-27T20:46:33.015239+00:00 heroku[web.1]: State changed from starting to up
wsgi.py:
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "resume_app.settings")
application = get_wsgi_application()
settings/base.py:
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'MY SECRET KEY'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
LOGIN_URL ='/login/'
LOGIN_REDIRECT_URL = '/resume/index'
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'builder',
'rest_framework',
)
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',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'resume_app.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["/".join((BASE_DIR,"resume_app/templates")),
"/".join((BASE_DIR,"builder/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 = 'resume_app.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Toronto'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
#STATIC_ROOT = '/home/ubuntu/Apps/Django/resume_app/src/static/static_root/'
STATIC_ROOT = os.path.join(BASE_DIR,'static','static_root')
STATICFILES_DIRS = (
#'/home/ubuntu/Apps/Django/resume_app/src/static/static_dirs/',
os.path.join(BASE_DIR,'static','static_dirs'),
)
MEDIA_URL = '/media/'
#MEDIA_ROOT = '/home/ubuntu/Apps/Django/resume_app/src/static/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'static','media')
settings/production.py: (inherits from base.py)
import os
import dj_database_url
from django.conf import settings
DEBUG = False
TEMPLATE_DEBUG = True
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "resume_app.settings")
DATABASES = settings.DATABASES
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow all host headers
ALLOWED_HOSTS = ['stormy-depths-4606.herokuapp.com',]
# Static asset configuration
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
Any help would be greatly appreciated. Thanks!
EDIT: Here's my procfile:
web: gunicorn resume_app.wsgi --log-file -