I have been trying to deploy an app to Heroku (no frills, just a simple page) but have not managed to do so. This is my log file -
2014-08-03T21:02:53.886884+00:00 heroku[web.1]: Starting process with command `gunicorn TestApp.wsgi`
2014-08-03T21:02:57.218280+00:00 heroku[web.1]: Process exited with status 3
2014-08-03T21:03:00.994045+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
host=fierce-oasis-7567.herokuapp.com request_id=f53c4902-5a52-4591-a099-ef006a4658d0 fwd="202.78.172.162"
dyno= connect= service= status=503 bytes=
2014-08-03T21:03:02.570801+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/favicon.ico" host=fierce-oasis-7567.herokuapp.com request_id=22872708-cf36-47b1- a5e6-552b7a1a8668
fwd="202.78.172.162" dyno= connect= service= status=503 bytes=
2014-08-03T21:14:34+00:00 heroku[slug-compiler]: Slug compilation started
2014-08-03T21:15:02+00:00 heroku[slug-compiler]: Slug compilation finished
2014-08-03T21:15:02.272206+00:00 heroku[web.1]: State changed from crashed to starting
2014-08-03T21:15:02.150270+00:00 heroku[api]: Deploy 9b69a49 by utsav.tiwary2011#gmail.com
2014-08-03T21:15:02.150376+00:00 heroku[api]: Release v8 created by utsav.tiwary2011#gmail.com
2014-08-03T21:15:06.900391+00:00 app[web.1]: Traceback (most recent call last):
2014-08-03T21:15:06.900398+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-08-03T21:15:06.885690+00:00 app[web.1]: 2014-08-03 21:15:06 [2] [INFO] Starting gunicorn 18.0
2014-08-03T21:15:06.900396+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/workers/base.py", line 106, in init_process
2014-08-03T21:15:06.900402+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-08-03T21:15:06.900399+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/base.py", line 114, in wsgi
2014-08-03T21:15:06.900408+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/util.py", line 354, in import_app
2014-08-03T21:15:06.900404+00:00 app[web.1]: return self.load_wsgiapp()
2014-08-03T21:15:06.900411+00:00 app[web.1]: ImportError: No module named TestApp.wsgi
2014-08-03T21:15:06.900410+00:00 app[web.1]: __import__(module)
2014-08-03T21:15:06.900413+00:00 app[web.1]: Traceback (most recent call last):
2014-08-03T21:15:06.900419+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-08-03T21:15:06.900388+00:00 app[web.1]: 2014-08-03 21:15:06 [7] [ERROR] Exception in worker process:
2014-08-03T21:15:06.900406+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-08-03T21:15:06.900417+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/workers/base.py", line 106, in init_process
2014-08-03T21:15:06.886483+00:00 app[web.1]: 2014-08-03 21:15:06 [2] [INFO] Listening at:
http://0.0.0.0:3589 (2)
2014-08-03T21:15:06.900427+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-08-03T21:15:06.900414+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/arbit
er.py", line 495, in spawn_worker
2014-08-03T21:15:06.900416+00:00 app[web.1]: worker.init_process()
2014-08-03T21:15:06.900393+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-08-03T21:15:06.900394+00:00 app[web.1]: worker.init_process()
2014-08-03T21:15:06.900420+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/base.py", line 114, in wsgi
2014-08-03T21:15:06.896296+00:00 app[web.1]: 2014-08-03 21:15:06 [7] [INFO] Booting worker with pid: 7
2014-08-03T21:15:06.900421+00:00 app[web.1]: self.callable = self.load()
2014-08-03T21:15:06.900428+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/util.py", line 354, in import_app
2014-08-03T21:15:06.900401+00:00 app[web.1]: self.callable = self.load()
2014-08-03T21:15:06.900407+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-08-03T21:15:06.900423+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-08-03T21:15:06.900429+00:00 app[web.1]: __import__(module)
2014-08-03T21:15:06.900431+00:00 app[web.1]: ImportError: No module named TestApp.wsgi
2014-08-03T21:15:07.024019+00:00 app[web.1]: 2014-08-03 21:15:07 [2] [INFO] Shutting down: Master
2014-08-03T21:15:06.900424+00:00 app[web.1]: return self.load_wsgiapp()
2014-08-03T21:15:07.024128+00:00 app[web.1]: 2014-08-03 21:15:07 [2] [INFO] Reason: Worker failed to boot.
2014-08-03T21:15:06.886586+00:00 app[web.1]: 2014-08-03 21:15:06 [2] [INFO] Using worker: sync
2014-08-03T21:15:06.900425+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-08-03T21:15:06.900514+00:00 app[web.1]: 2014-08-03 21:15:06 [7] [INFO] Worker exiting (pid: 7)
2014-08-03T21:15:05.633019+00:00 heroku[web.1]: Starting process with command `gunicorn TestApp.wsgi`
2014-08-03T21:15:08.072497+00:00 heroku[web.1]: Process exited with status 3
2014-08-03T21:15:08.083536+00:00 heroku[web.1]: State changed from starting to crashed
2014-08-03T21:15:08.084259+00:00 heroku[web.1]: State changed from crashed to starting
2014-08-03T21:15:11.225689+00:00 heroku[web.1]: Starting process with command `gunicorn TestApp.wsgi`
2014-08-03T21:15:12.151723+00:00 app[web.1]: 2014-08-03 21:15:12 [2] [INFO] Starting gunicorn 18.0
2014-08-03T21:15:12.166252+00:00 app[web.1]: worker.init_process()
2014-08-03T21:15:12.166257+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/base.py", line 114, in wsgi
2014-08-03T21:15:12.166251+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-08-03T21:15:12.166249+00:00 app[web.1]: Traceback (most recent call last):
2014-08-03T21:15:12.166260+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-08-03T21:15:12.166246+00:00 app[web.1]: 2014-08-03 21:15:12 [7] [ERROR] Exception in worker process:
2014-08-03T21:15:12.166256+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-08-03T21:15:12.166265+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-08-03T21:15:12.166259+00:00 app[web.1]: self.callable = self.load()
2014-08-03T21:15:12.166262+00:00 app[web.1]: return self.load_wsgiapp()
2014-08-03T21:15:12.166254+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/workers/base.py", line 106, in init_process
2014-08-03T21:15:12.166263+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-08-03T21:15:12.166273+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/arbiter.py", line 495, i
n spawn_worker
2014-08-03T21:15:12.166271+00:00 app[web.1]: Traceback (most recent call last):
2014-08-03T21:15:12.166275+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/workers/base.py", line 106, in init_process
2014-08-03T21:15:12.166287+00:00 app[web.1]: __import__(module)
2014-08-03T21:15:12.166266+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/util.py", line 354, in import_app
2014-08-03T21:15:12.166281+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-08-03T21:15:12.166268+00:00 app[web.1]: __import__(module)
2014-08-03T21:15:12.166289+00:00 app[web.1]: ImportError: No module named TestApp.wsgi
2014-08-03T21:15:12.166274+00:00 app[web.1]: worker.init_process()
2014-08-03T21:15:12.166278+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/base.py", line 114, in wsgi
2014-08-03T21:15:12.166269+00:00 app[web.1]: ImportError: No module named TestApp.wsgi
2014-08-03T21:15:12.166285+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-08-03T21:15:12.166283+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-08-03T21:15:12.152842+00:00 app[web.1]: 2014-08-03 21:15:12 [2] [INFO] Using worker: sync
2014-08-03T21:15:12.166277+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-08-03T21:15:12.166282+00:00 app[web.1]: return self.load_wsgiapp()
2014-08-03T21:15:12.166279+00:00 app[web.1]: self.callable = self.load()
2014-08-03T21:15:12.152750+00:00 app[web.1]: 2014-08-03 21:15:12 [2] [INFO] Listening at:
http://0.0.0.0:28415 (2)
2014-08-03T21:15:12.287650+00:00 app[web.1]: 2014-08-03 21:15:12 [2] [INFO] Reason: Worker failed to boot.
2014-08-03T21:15:12.287529+00:00 app[web.1]: 2014-08-03 21:15:12 [2] [INFO] Shutting down: Master
2014-08-03T21:15:12.166286+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-
packages/gunicorn/util.py", line 354, in import_app
2014-08-03T21:15:12.166363+00:00 app[web.1]: 2014-08-03 21:15:12 [7] [INFO] Worker exiting (pid: 7)
2014-08-03T21:15:12.162414+00:00 app[web.1]: 2014-08-03 21:15:12 [7] [INFO] Booting worker with pid: 7
2014-08-03T21:15:15.136154+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
host=fierce-oasis-7567.herokuapp.com request_id=86c520f6-3c60-4817-a006-7d5111a22a3c fwd="54.83.118.7" dyno=
connect= service= status=503 bytes=
2014-08-03T21:15:13.398231+00:00 heroku[web.1]: State changed from starting to crashed
2014-08-03T21:15:13.379837+00:00 heroku[web.1]: Process exited with status 3
And this is my Procfile :
web: gunicorn TestApp.wsgi
This is my requirements.txt
Django<=1.3.1
dj-database-url==0.3.0
psycopg2==2.4.5
gunicorn==18.0
wsgiref==0.1.2
dj-static==0.0.5
static==0.4
This is my settings file:
# Django settings for TestApp project.
import os
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['*']
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_PATH, 'static'),
)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email#example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
# Additional locations of static files
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'n(bd1f1c%e8=_xad02x5qtfn%wgwpi492e$8_erx+d)!tpeoim'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'TestApp.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'TestApp.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'gunicorn',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
import dj_database_url
DATABASES['default'] = dj_database_url.config()
Procfile : web: sh -c "cd TestApp && gunicorn TestApp.wsgi"
Basically, my error is that it is not able to locate TestApp.wsgi and hence crashes every time. I followed the following steps while deploying -
git add -A.
git commit -m"commit"
git push heroku master
git ps
Can anyone please help me figure out what is wrong ? Thanks in advance ! (Please let me know if any other file/detail
is needed)
Related
Im trying to deploy a django site using Heroku and I keep running into this error when the page tries to load
with heroku logs --tail
» Warning: heroku update available from 7.53.0 to 7.60.2.
2022-05-18T01:09:37.493808+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-05-18T01:09:37.493808+00:00 app[web.1]: worker.init_process()
2022-05-18T01:09:37.493808+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-05-18T01:09:37.493809+00:00 app[web.1]: self.load_wsgi()
2022-05-18T01:09:37.493809+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-05-18T01:09:37.493810+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-05-18T01:09:37.493810+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-05-18T01:09:37.493810+00:00 app[web.1]: self.callable = self.load()
2022-05-18T01:09:37.493811+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-05-18T01:09:37.493811+00:00 app[web.1]: return self.load_wsgiapp()
2022-05-18T01:09:37.493811+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-05-18T01:09:37.493812+00:00 app[web.1]: return util.import_app(self.app_uri)
2022-05-18T01:09:37.493812+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2022-05-18T01:09:37.493812+00:00 app[web.1]: mod = importlib.import_module(module)
2022-05-18T01:09:37.493813+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-05-18T01:09:37.493813+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-05-18T01:09:37.493813+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-05-18T01:09:37.493814+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-05-18T01:09:37.493814+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2022-05-18T01:09:37.493814+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2022-05-18T01:09:37.493815+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2022-05-18T01:09:37.493815+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2022-05-18T01:09:37.493815+00:00 app[web.1]: File "/app/GroomingService/GroomingService/wsgi.py", line 16, in <module>
2022-05-18T01:09:37.493816+00:00 app[web.1]: application = get_wsgi_application()
2022-05-18T01:09:37.493816+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-05-18T01:09:37.493816+00:00 app[web.1]: django.setup(set_prefix=False)
2022-05-18T01:09:37.493817+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
2022-05-18T01:09:37.493817+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2022-05-18T01:09:37.493818+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
2022-05-18T01:09:37.493818+00:00 app[web.1]: app_config = AppConfig.create(entry)
2022-05-18T01:09:37.493818+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/apps/config.py", line 223, in create
2022-05-18T01:09:37.493819+00:00 app[web.1]: import_module(entry)
2022-05-18T01:09:37.493819+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-05-18T01:09:37.493819+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-05-18T01:09:37.493820+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-05-18T01:09:37.493820+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-05-18T01:09:37.493820+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2022-05-18T01:09:37.493821+00:00 app[web.1]: ModuleNotFoundError: No module named 'appointmentApp'
2022-05-18T01:09:37.493884+00:00 app[web.1]: [2022-05-17 18:09:37 -0700] [10] [INFO] Worker exiting (pid: 10)
2022-05-18T01:09:37.493951+00:00 app[web.1]: [2022-05-17 18:09:37 -0700] [9] [INFO] Worker exiting (pid: 9)
2022-05-18T01:09:37.553717+00:00 heroku[web.1]: State changed from starting to up
2022-05-18T01:09:37.553815+00:00 app[web.1]: Traceback (most recent call last):
2022-05-18T01:09:37.553820+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 209, in run
2022-05-18T01:09:37.554025+00:00 app[web.1]: self.sleep()
2022-05-18T01:09:37.554037+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 357, in sleep
2022-05-18T01:09:37.554155+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2022-05-18T01:09:37.554157+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-05-18T01:09:37.554242+00:00 app[web.1]: self.reap_workers()
2022-05-18T01:09:37.554243+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-05-18T01:09:37.554366+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-05-18T01:09:37.554411+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-05-18T01:09:37.554413+00:00 app[web.1]:
2022-05-18T01:09:37.554413+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-05-18T01:09:37.554413+00:00 app[web.1]:
2022-05-18T01:09:37.554415+00:00 app[web.1]: Traceback (most recent call last):
2022-05-18T01:09:37.554423+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 642, in kill_worker
2022-05-18T01:09:37.554565+00:00 app[web.1]: os.kill(pid, sig)
2022-05-18T01:09:37.554588+00:00 app[web.1]: ProcessLookupError: [Errno 3] No such process
2022-05-18T01:09:37.554590+00:00 app[web.1]:
2022-05-18T01:09:37.554590+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-05-18T01:09:37.554590+00:00 app[web.1]:
2022-05-18T01:09:37.554591+00:00 app[web.1]: Traceback (most recent call last):
2022-05-18T01:09:37.554600+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2022-05-18T01:09:37.554663+00:00 app[web.1]: sys.exit(run())
2022-05-18T01:09:37.554671+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
2022-05-18T01:09:37.554736+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2022-05-18T01:09:37.554743+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 231, in run
2022-05-18T01:09:37.554825+00:00 app[web.1]: super().run()
2022-05-18T01:09:37.554833+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 72, in run
2022-05-18T01:09:37.554896+00:00 app[web.1]: Arbiter(self).run()
2022-05-18T01:09:37.554897+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 229, in run
2022-05-18T01:09:37.554979+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2022-05-18T01:09:37.554981+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 342, in halt
2022-05-18T01:09:37.555076+00:00 app[web.1]: self.stop()
2022-05-18T01:09:37.555084+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 390, in stop
2022-05-18T01:09:37.555186+00:00 app[web.1]: self.kill_workers(sig)
2022-05-18T01:09:37.555187+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 632, in kill_workers
2022-05-18T01:09:37.555323+00:00 app[web.1]: self.kill_worker(pid, sig)
2022-05-18T01:09:37.555325+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 644, in kill_worker
2022-05-18T01:09:37.555460+00:00 app[web.1]: if e.errno == errno.ESRCH:
2022-05-18T01:09:37.555462+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-05-18T01:09:37.555542+00:00 app[web.1]: self.reap_workers()
2022-05-18T01:09:37.555551+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-05-18T01:09:37.555663+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-05-18T01:09:37.555693+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-05-18T01:09:37.697703+00:00 heroku[web.1]: Process exited with status 1
2022-05-18T01:09:37.764077+00:00 heroku[web.1]: State changed from up to crashed
2022-05-18T01:09:51.528658+00:00 app[api]: Set maintenance mode off by user danccoral#hotmail.com
2022-05-18T01:10:13.487012+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=elizabethselegantdoggrooming.herokuapp.com request_id=3f02a257-18d8-438d-bcac-778254354ad4 fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
2022-05-18T01:10:14.027724+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=elizabethselegantdoggrooming.herokuapp.com request_id=f61fe659-2371-48f5-9c94-87339a85b363 fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
2022-05-18T01:10:29.138152+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=elizabethselegantdoggrooming.herokuapp.com request_id=4ef2c6f9-ef8b-4798-a310-8c76e305d2eb fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
2022-05-18T01:10:29.502227+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=elizabethselegantdoggrooming.herokuapp.com request_id=84e71487-1c60-4024-b27f-37f24a8bf6c6 fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
2022-05-18T01:12:44.961980+00:00 app[api]: Starting process with command `printenv` by user danccoral#hotmail.com
2022-05-18T01:12:51.062148+00:00 heroku[run.5944]: Awaiting client
2022-05-18T01:12:51.079149+00:00 heroku[run.5944]: Starting process with command `printenv`
2022-05-18T01:12:51.186266+00:00 heroku[run.5944]: State changed from starting to up
2022-05-18T01:12:54.516779+00:00 heroku[run.5944]: Process exited with status 0
2022-05-18T01:12:54.655109+00:00 heroku[run.5944]: State changed from up to complete
2022-05-18T01:31:48.081568+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=elizabethselegantdoggrooming.herokuapp.com request_id=a13a7884-78a3-461e-be0e-f047d101ffd3 fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
2022-05-18T01:31:48.450104+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=elizabethselegantdoggrooming.herokuapp.com request_id=9473141e-ed72-4fb5-8c9b-9264f9b7f42f fwd="139.182.209.45" dyno= connect= service= status=503 bytes= protocol=https
the two most notable things I could find from this error list were
2022-05-18T01:09:37.493821+00:00 app[web.1]: ModuleNotFoundError: No module named 'appointmentApp'
and
2022-05-18T01:09:37.554411+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
I know that with error H10 there might be something wrong with my procfile
web: gunicorn GroomingService.GroomingService.wsgi
My project file struture
Project/
GroomingService/
accountApp/
adminApp/
appointmentApp/
GroomingService/
__pycache__
_init_.py
asagi.py
settings.py
urls.py
views.py
wsgi.py
loginApp/
static/
staticfiles/
templates/
.env
.gitattributes
Procfile
README.md
requirements.txt
runtime.txt
Earlier I was also having trouble because it was telling me that
wsgi could not found
No module named 'GroomingService.wsgi'
and then that settings could not be found
Because of that I added an extra GroomingService to the file path so that it could find it in both my Procfile and my wsgifile
#wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'GroomingService.GroomingService.settings')
application = get_wsgi_application()
procfile
web: gunicorn GroomingService.GroomingService.wsgi
requirements.txt
asgiref==3.5.0
dj-database-url==0.5.0
Django==4.0.1
django-activeurl==0.2.0
django-appconf==1.0.5
django-classy-tags==3.0.1
django-crispy-forms==1.14.0
django-environ==0.8.1
django-heroku==0.3.1
gunicorn==20.1.0
lxml==4.8.0
psycopg2==2.9.3
python-decouple==3.6
python-dotenv==0.20.0
sqlparse==0.4.2
tzdata==2021.5
whitenoise==6.1.0
runtime.txt
python-3.9.12
Edit:
settings.py
from pathlib import Path
import os
from decouple import config
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['elizabethselegantdoggrooming.herokuapp.com/', '127.0.0.1', 'elizabethselegantdoggrooming.com']
#is used for crispyforms?
CRISPY_TEMPLATE_PACK = 'bootstrap5'
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#django apps
'crispy_forms',
'appointmentApp',
'loginApp',
'accountApp',
'adminApp',
]
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',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'GroomingService.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(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 = 'GroomingService.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.0/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/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Los_Angeles'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = 'static/'
STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), )
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
#csrf
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
SECURE_SSL_REDIRECT = True
How can I direct it to find the modules?
I had to back track, if someone else runs into this, you might be having the same issue
Basically this
Couldn't find WSGI module deploying Heroku
The file structure is wrong manage.py has to be at the root of the project, where Procfile and requirements.txt are, but if that's not possible to change then you can change the proc file
old procfile
web: gunicorn GroomingService.GroomingService.wsgi
new procfile
web: gunicorn --pythonpath GroomingService GroomingService.wsgi
Check your settings.py file, you might have not registered that app in your INSTALLED_APPS section.
I am trying to deploy my Django project on Heroku.But everytime, I have got same error. Heroku restart doesnot work for me. I cleared buildpack and added python buildpack. This has not work for me. I also tried different host like ALLOWED_HOSTS = ['*', '127.0.0.1', 'dailynotes.herokuapp.com']. In Procfile I tried different way like web: gunicorn ToDoApps.wsgi: --log-file -
and
web: gunicorn ToDoApps.wsgi:application --log-file - --log-level debug
python manage.py collectstatic --noinput
manage.py migrate
This does not work for me.
crashed file
2021-08-18T09:37:39.832259+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dailynotes.herokuapp.com request_id=81cc172e-247e-4aa9-8b39-fb9440cd67d2 fwd="103.14.72.227" dyno= connect= service= status=503 bytes= protocol=https
2021-08-18T09:37:40.734680+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=dailynotes.herokuapp.com request_id=8d2598b4-0521-4519-892a-467d2a2642ca fwd="103.14.72.227" dyno= connect= service= status=503 bytes= protocol=https
logs --tail
2021-08-18T09:21:46.641887+00:00 app[web.1]: preload_app: False
2021-08-18T09:21:46.641888+00:00 app[web.1]: sendfile: None
2021-08-18T09:21:46.641888+00:00 app[web.1]: reuse_port: False
2021-08-18T09:21:46.641888+00:00 app[web.1]: chdir: /app
2021-08-18T09:21:46.641889+00:00 app[web.1]: daemon: False
2021-08-18T09:21:46.641889+00:00 app[web.1]: raw_env: []
2021-08-18T09:21:46.641889+00:00 app[web.1]: pidfile: None
2021-08-18T09:21:46.641889+00:00 app[web.1]: worker_tmp_dir: None
2021-08-18T09:21:46.641890+00:00 app[web.1]: user: 9071
2021-08-18T09:21:46.641890+00:00 app[web.1]: group: 9071
2021-08-18T09:21:46.641890+00:00 app[web.1]: umask: 0
2021-08-18T09:21:46.641891+00:00 app[web.1]: initgroups: False
2021-08-18T09:21:46.641891+00:00 app[web.1]: tmp_upload_dir: None
2021-08-18T09:21:46.641909+00:00 app[web.1]: secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
2021-08-18T09:21:46.641909+00:00 app[web.1]: forwarded_allow_ips: ['*']
2021-08-18T09:21:46.641909+00:00 app[web.1]: accesslog: -
2021-08-18T09:21:46.641910+00:00 app[web.1]: disable_redirect_access_to_syslog: False
2021-08-18T09:21:46.641916+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"
2021-08-18T09:21:46.641917+00:00 app[web.1]: errorlog: -
2021-08-18T09:21:46.641917+00:00 app[web.1]: loglevel: debug
2021-08-18T09:21:46.641918+00:00 app[web.1]: capture_output: False
2021-08-18T09:21:46.641918+00:00 app[web.1]: logger_class: gunicorn.glogging.Logger
2021-08-18T09:21:46.641918+00:00 app[web.1]: logconfig: None
2021-08-18T09:21:46.641919+00:00 app[web.1]: logconfig_dict: {}
2021-08-18T09:21:46.641919+00:00 app[web.1]: syslog_addr: udp://localhost:514
2021-08-18T09:21:46.641919+00:00 app[web.1]: syslog: False
2021-08-18T09:21:46.641920+00:00 app[web.1]: syslog_prefix: None
2021-08-18T09:21:46.641920+00:00 app[web.1]: syslog_facility: user
2021-08-18T09:21:46.641921+00:00 app[web.1]: enable_stdio_inheritance: False
2021-08-18T09:21:46.641921+00:00 app[web.1]: statsd_host: None
2021-08-18T09:21:46.641921+00:00 app[web.1]: dogstatsd_tags:
2021-08-18T09:21:46.641922+00:00 app[web.1]: statsd_prefix:
2021-08-18T09:21:46.641922+00:00 app[web.1]: proc_name: None
2021-08-18T09:21:46.641923+00:00 app[web.1]: default_proc_name: ToDoApps.wsgi:application
2021-08-18T09:21:46.641923+00:00 app[web.1]: pythonpath: None
2021-08-18T09:21:46.641923+00:00 app[web.1]: paste: None
2021-08-18T09:21:46.642453+00:00 app[web.1]: on_starting: <function OnStarting.on_starting at 0x7fef7fcbb9d0>
2021-08-18T09:21:46.642454+00:00 app[web.1]: on_reload: <function OnReload.on_reload at 0x7fef7fcbbaf0>
2021-08-18T09:21:46.642454+00:00 app[web.1]: when_ready: <function WhenReady.when_ready at 0x7fef7fcbbc10>
2021-08-18T09:21:46.642455+00:00 app[web.1]: pre_fork: <function Prefork.pre_fork at 0x7fef7fcbbd30>
2021-08-18T09:21:46.642455+00:00 app[web.1]: post_fork: <function Postfork.post_fork at 0x7fef7fcbbe50>
2021-08-18T09:21:46.642455+00:00 app[web.1]: post_worker_init: <function PostWorkerInit.post_worker_init at 0x7fef7fcbbf70>
2021-08-18T09:21:46.642456+00:00 app[web.1]: worker_int: <function WorkerInt.worker_int at 0x7fef7fccc0d0>
2021-08-18T09:21:46.642456+00:00 app[web.1]: worker_abort: <function WorkerAbort.worker_abort at 0x7fef7fccc1f0>
2021-08-18T09:21:46.642456+00:00 app[web.1]: pre_exec: <function PreExec.pre_exec at 0x7fef7fccc310>
2021-08-18T09:21:46.642457+00:00 app[web.1]: pre_request: <function PreRequest.pre_request at 0x7fef7fccc430>
2021-08-18T09:21:46.642457+00:00 app[web.1]: post_request: <function PostRequest.post_request at 0x7fef7fccc4c0>
2021-08-18T09:21:46.642458+00:00 app[web.1]: child_exit: <function ChildExit.child_exit at 0x7fef7fccc5e0>
2021-08-18T09:21:46.642458+00:00 app[web.1]: worker_exit: <function WorkerExit.worker_exit at 0x7fef7fccc700>
2021-08-18T09:21:46.642458+00:00 app[web.1]: nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7fef7fccc820>
2021-08-18T09:21:46.642459+00:00 app[web.1]: on_exit: <function OnExit.on_exit at 0x7fef7fccc940>
2021-08-18T09:21:46.642459+00:00 app[web.1]: proxy_protocol: False
2021-08-18T09:21:46.642459+00:00 app[web.1]: proxy_allow_ips: ['127.0.0.1']
2021-08-18T09:21:46.642460+00:00 app[web.1]: keyfile: None
2021-08-18T09:21:46.642460+00:00 app[web.1]: certfile: None
2021-08-18T09:21:46.642460+00:00 app[web.1]: ssl_version: 2
2021-08-18T09:21:46.642461+00:00 app[web.1]: cert_reqs: 0
2021-08-18T09:21:46.642461+00:00 app[web.1]: ca_certs: None
2021-08-18T09:21:46.642461+00:00 app[web.1]: suppress_ragged_eofs: True
2021-08-18T09:21:46.642462+00:00 app[web.1]: do_handshake_on_connect: False
2021-08-18T09:21:46.642462+00:00 app[web.1]: ciphers: None
2021-08-18T09:21:46.642462+00:00 app[web.1]: raw_paste_global_conf: []
2021-08-18T09:21:46.642463+00:00 app[web.1]: strip_header_spaces: False
2021-08-18T09:21:46.643622+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-08-18T09:21:46.644633+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [DEBUG] Arbiter booted
2021-08-18T09:21:46.644821+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Listening at: http://0.0.0.0:44920 (4)
2021-08-18T09:21:46.645051+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Using worker: sync
2021-08-18T09:21:46.652069+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [INFO] Booting worker with pid: 7
2021-08-18T09:21:46.662712+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [ERROR] Exception in worker process
2021-08-18T09:21:46.662715+00:00 app[web.1]: Traceback (most recent call last):
2021-08-18T09:21:46.662715+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-08-18T09:21:46.662716+00:00 app[web.1]: worker.init_process()
2021-08-18T09:21:46.662716+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-08-18T09:21:46.662717+00:00 app[web.1]: self.load_wsgi()
2021-08-18T09:21:46.662717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-08-18T09:21:46.662718+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-08-18T09:21:46.662718+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-08-18T09:21:46.662718+00:00 app[web.1]: self.callable = self.load()
2021-08-18T09:21:46.662719+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-08-18T09:21:46.662719+00:00 app[web.1]: return self.load_wsgiapp()
2021-08-18T09:21:46.662719+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-08-18T09:21:46.662720+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-08-18T09:21:46.662720+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-08-18T09:21:46.662720+00:00 app[web.1]: mod = importlib.import_module(module)
2021-08-18T09:21:46.662721+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-08-18T09:21:46.662721+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-08-18T09:21:46.662722+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-08-18T09:21:46.662722+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2021-08-18T09:21:46.662724+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-08-18T09:21:46.662724+00:00 app[web.1]: File "/app/ToDoApps/wsgi.py", line 12, in <module>
2021-08-18T09:21:46.662725+00:00 app[web.1]: from django.core.wsgi import get_wsgi_application
2021-08-18T09:21:46.662725+00:00 app[web.1]: ModuleNotFoundError: No module named 'django'
2021-08-18T09:21:46.662924+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-08-18T09:21:46.707594+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Shutting down: Master
2021-08-18T09:21:46.707848+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-08-18T09:21:46.836081+00:00 heroku[web.1]: Process exited with status 3
2021-08-18T09:21:47.118125+00:00 heroku[web.1]: State changed from starting to crashed
2021-08-18T09:21:46.641887+00:00 app[web.1]: preload_app: False
2021-08-18T09:21:46.641888+00:00 app[web.1]: sendfile: None
2021-08-18T09:21:46.641888+00:00 app[web.1]: reuse_port: False
2021-08-18T09:21:46.641888+00:00 app[web.1]: chdir: /app
2021-08-18T09:21:46.641889+00:00 app[web.1]: daemon: False
2021-08-18T09:21:46.641889+00:00 app[web.1]: raw_env: []
2021-08-18T09:21:46.641889+00:00 app[web.1]: pidfile: None
2021-08-18T09:21:46.641889+00:00 app[web.1]: worker_tmp_dir: None
2021-08-18T09:21:46.641890+00:00 app[web.1]: user: 9071
2021-08-18T09:21:46.641890+00:00 app[web.1]: group: 9071
2021-08-18T09:21:46.641890+00:00 app[web.1]: umask: 0
2021-08-18T09:21:46.641891+00:00 app[web.1]: initgroups: False
2021-08-18T09:21:46.641891+00:00 app[web.1]: tmp_upload_dir: None
2021-08-18T09:21:46.641909+00:00 app[web.1]: secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
2021-08-18T09:21:46.641909+00:00 app[web.1]: forwarded_allow_ips: ['*']
2021-08-18T09:21:46.641909+00:00 app[web.1]: accesslog: -
2021-08-18T09:21:46.641910+00:00 app[web.1]: disable_redirect_access_to_syslog: False
2021-08-18T09:21:46.641916+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"
2021-08-18T09:21:46.641917+00:00 app[web.1]: errorlog: -
2021-08-18T09:21:46.641917+00:00 app[web.1]: loglevel: debug
2021-08-18T09:21:46.641918+00:00 app[web.1]: capture_output: False
2021-08-18T09:21:46.641918+00:00 app[web.1]: logger_class: gunicorn.glogging.Logger
2021-08-18T09:21:46.641918+00:00 app[web.1]: logconfig: None
2021-08-18T09:21:46.641919+00:00 app[web.1]: logconfig_dict: {}
2021-08-18T09:21:46.641919+00:00 app[web.1]: syslog_addr: udp://localhost:514
2021-08-18T09:21:46.641919+00:00 app[web.1]: syslog: False
2021-08-18T09:21:46.641920+00:00 app[web.1]: syslog_prefix: None
2021-08-18T09:21:46.641920+00:00 app[web.1]: syslog_facility: user
2021-08-18T09:21:46.641921+00:00 app[web.1]: enable_stdio_inheritance: False
2021-08-18T09:21:46.641921+00:00 app[web.1]: statsd_host: None
2021-08-18T09:21:46.641921+00:00 app[web.1]: dogstatsd_tags:
2021-08-18T09:21:46.641922+00:00 app[web.1]: statsd_prefix:
2021-08-18T09:21:46.641922+00:00 app[web.1]: proc_name: None
2021-08-18T09:21:46.641923+00:00 app[web.1]: default_proc_name: ToDoApps.wsgi:application
2021-08-18T09:21:46.641923+00:00 app[web.1]: pythonpath: None
2021-08-18T09:21:46.641923+00:00 app[web.1]: paste: None
2021-08-18T09:21:46.642453+00:00 app[web.1]: on_starting: <function OnStarting.on_starting at 0x7fef7fcbb9d0>
2021-08-18T09:21:46.642454+00:00 app[web.1]: on_reload: <function OnReload.on_reload at 0x7fef7fcbbaf0>
2021-08-18T09:21:46.642454+00:00 app[web.1]: when_ready: <function WhenReady.when_ready at 0x7fef7fcbbc10>
2021-08-18T09:21:46.642455+00:00 app[web.1]: pre_fork: <function Prefork.pre_fork at 0x7fef7fcbbd30>
2021-08-18T09:21:46.642455+00:00 app[web.1]: post_fork: <function Postfork.post_fork at 0x7fef7fcbbe50>
2021-08-18T09:21:46.642455+00:00 app[web.1]: post_worker_init: <function PostWorkerInit.post_worker_init at 0x7fef7fcbbf70>
2021-08-18T09:21:46.642456+00:00 app[web.1]: worker_int: <function WorkerInt.worker_int at 0x7fef7fccc0d0>
2021-08-18T09:21:46.642456+00:00 app[web.1]: worker_abort: <function WorkerAbort.worker_abort at 0x7fef7fccc1f0>
2021-08-18T09:21:46.642456+00:00 app[web.1]: pre_exec: <function PreExec.pre_exec at 0x7fef7fccc310>
2021-08-18T09:21:46.642457+00:00 app[web.1]: pre_request: <function PreRequest.pre_request at 0x7fef7fccc430>
2021-08-18T09:21:46.642457+00:00 app[web.1]: post_request: <function PostRequest.post_request at 0x7fef7fccc4c0>
2021-08-18T09:21:46.642458+00:00 app[web.1]: child_exit: <function ChildExit.child_exit at 0x7fef7fccc5e0>
2021-08-18T09:21:46.642458+00:00 app[web.1]: worker_exit: <function WorkerExit.worker_exit at 0x7fef7fccc700>
2021-08-18T09:21:46.642458+00:00 app[web.1]: nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7fef7fccc820>
2021-08-18T09:21:46.642459+00:00 app[web.1]: on_exit: <function OnExit.on_exit at 0x7fef7fccc940>
2021-08-18T09:21:46.642459+00:00 app[web.1]: proxy_protocol: False
2021-08-18T09:21:46.642459+00:00 app[web.1]: proxy_allow_ips: ['127.0.0.1']
2021-08-18T09:21:46.642460+00:00 app[web.1]: keyfile: None
2021-08-18T09:21:46.642460+00:00 app[web.1]: certfile: None
2021-08-18T09:21:46.642460+00:00 app[web.1]: ssl_version: 2
2021-08-18T09:21:46.642461+00:00 app[web.1]: cert_reqs: 0
2021-08-18T09:21:46.642461+00:00 app[web.1]: ca_certs: None
2021-08-18T09:21:46.642461+00:00 app[web.1]: suppress_ragged_eofs: True
2021-08-18T09:21:46.642462+00:00 app[web.1]: do_handshake_on_connect: False
2021-08-18T09:21:46.642462+00:00 app[web.1]: ciphers: None
2021-08-18T09:21:46.642462+00:00 app[web.1]: raw_paste_global_conf: []
2021-08-18T09:21:46.642463+00:00 app[web.1]: strip_header_spaces: False
2021-08-18T09:21:46.643622+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Starting gunicorn 20.1.0
2021-08-18T09:21:46.644633+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [DEBUG] Arbiter booted
2021-08-18T09:21:46.644821+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Listening at: http://0.0.0.0:44920 (4)
2021-08-18T09:21:46.645051+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Using worker: sync
2021-08-18T09:21:46.652069+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [INFO] Booting worker with pid: 7
2021-08-18T09:21:46.662712+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [ERROR] Exception in worker process
2021-08-18T09:21:46.662715+00:00 app[web.1]: Traceback (most recent call last):
2021-08-18T09:21:46.662715+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-08-18T09:21:46.662716+00:00 app[web.1]: worker.init_process()
2021-08-18T09:21:46.662716+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-08-18T09:21:46.662717+00:00 app[web.1]: self.load_wsgi()
2021-08-18T09:21:46.662717+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-08-18T09:21:46.662718+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-08-18T09:21:46.662718+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-08-18T09:21:46.662718+00:00 app[web.1]: self.callable = self.load()
2021-08-18T09:21:46.662719+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-08-18T09:21:46.662719+00:00 app[web.1]: return self.load_wsgiapp()
2021-08-18T09:21:46.662719+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-08-18T09:21:46.662720+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-08-18T09:21:46.662720+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-08-18T09:21:46.662720+00:00 app[web.1]: mod = importlib.import_module(module)
2021-08-18T09:21:46.662721+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-08-18T09:21:46.662721+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-08-18T09:21:46.662722+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-08-18T09:21:46.662722+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2021-08-18T09:21:46.662723+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2021-08-18T09:21:46.662724+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-08-18T09:21:46.662724+00:00 app[web.1]: File "/app/ToDoApps/wsgi.py", line 12, in <module>
2021-08-18T09:21:46.662725+00:00 app[web.1]: from django.core.wsgi import get_wsgi_application
2021-08-18T09:21:46.662725+00:00 app[web.1]: ModuleNotFoundError: No module named 'django'
2021-08-18T09:21:46.662924+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-08-18T09:21:46.707594+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Shutting down: Master
2021-08-18T09:21:46.707848+00:00 app[web.1]: [2021-08-18 09:21:46 +0000] [4] [INFO] Reason: Worker failed to boot.
2021-08-18T09:21:46.836081+00:00 heroku[web.1]: Process exited with status 3
2021-08-18T09:21:47.118125+00:00 heroku[web.1]: State changed from starting to crashed
Procfile
web: gunicorn ToDoApps.wsgi
settings.py
from pathlib import Path
import os
import dj_database_url
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-z913vx8_t5o#ahodt51t37t4-*9ytn3k*#zi%)lcl26wq=v2k3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['*'] #new
# Application definition
INSTALLED_APPS = [
'whitenoise.runserver_nostatic', #New
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
#'whitenoise.runserver_nostatic',#New
'django.contrib.staticfiles',
'second',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', #new
'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',
]
ROOT_URLCONF = 'ToDoApps.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['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 = 'ToDoApps.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
WHITENOISE_USE_FINDERS = True #New
# Password validation
# https://docs.djangoproject.com/en/3.2/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/3.2/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/3.2/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') #New!
STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
#STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' #new!
#New start
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
#New End
It works after few changes. I missed to run python3 manage.py collectstatic . Then pushing to github. I removed buildpacks before deploying. and followed this tutorial https://www.codechit.com/django-github-auto-deployment-to-heroku/
Build is successdul and it is producing application error, i have set up host name and debug=False as suggested but it is still causing error in opening the browser window, i am new to heroku so please suggest what needs to be done to make it work
my settings.py
"""
Django settings for djangoTut project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
print(BASE_DIR)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = mysecretkey
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['djangoblog-project.herokuapp.com']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog.apps.BlogConfig',
'users.apps.UsersConfig',
'crispy_forms',
]
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',
]
ROOT_URLCONF = 'djangoTut.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 = 'djangoTut.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'DATABASE' : 'DjangoProject',
'NAME': 'DjangoProject',
'USER' : 'myprojectuser',
'PASSWORD' : 'Akbar#123456',
'HOST': 'localhost',
'PORT': '',
# 'default-character-se' : 'utf8',
# 'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/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/3.2/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/3.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
STATICFILES_DIRS = [
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# STATIC_ROOT = os.path.join(BASE_DIR, 'assets')
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
LOGIN_REDIRECT_URL = 'blogHome'
LOGIN_URL = 'login'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
requirements.txt for the current django project
requirements.txt
boto3==1.9.96
botocore==1.12.96
certifi==2018.10.15
chardet==3.0.4
dj-database-url==0.5.0
Django==2.1
django-crispy-forms==1.7.2
django-heroku==0.3.1
django-storages==1.7.1
docutils==0.14
gunicorn==19.9.0
idna==2.7
jmespath==0.9.3
Pillow==5.2.0
python-dateutil==2.8.0
pytz==2018.5
requests==2.19.1
s3transfer==0.2.0
six==1.12.0
urllib3==1.23
whitenoise==4.1.2
heroku logs
› Warning: heroku update available from 7.52.0 to 7.54.0.
2021-06-12T09:49:28.101517+00:00 app[web.1]: Arbiter(self).run()
2021-06-12T09:49:28.101521+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 232, in run
2021-06-12T09:49:28.101745+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2021-06-12T09:49:28.101747+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 345, in halt
2021-06-12T09:49:28.101999+00:00 app[web.1]: self.stop()
2021-06-12T09:49:28.102004+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 393, in stop
2021-06-12T09:49:28.102241+00:00 app[web.1]: time.sleep(0.1)
2021-06-12T09:49:28.102246+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2021-06-12T09:49:28.102398+00:00 app[web.1]: self.reap_workers()
2021-06-12T09:49:28.102404+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2021-06-12T09:49:28.102716+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2021-06-12T09:49:28.102754+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2021-06-12T09:49:28.205668+00:00 heroku[web.1]: Process exited with status 1
2021-06-12T09:49:28.284579+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-12T09:49:34.912538+00:00 app[api]: Release v9 created by user dhruv.singhal2612#gmail.com
2021-06-12T09:49:34.912538+00:00 app[api]: Set DEBUG_VALUE config vars by user dhruv.singhal2612#gmail.com
2021-06-12T09:49:35.143657+00:00 heroku[web.1]: State changed from crashed to starting
2021-06-12T09:49:41.619208+00:00 heroku[web.1]: Starting process with command `gunicorn django_project.wsgi`
2021-06-12T09:49:45.299640+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [4] [INFO] Starting gunicorn 19.9.0
2021-06-12T09:49:45.300103+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [4] [INFO] Listening at: http://0.0.0.0:16332 (4)
2021-06-12T09:49:45.300346+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [4] [INFO] Using worker: sync
2021-06-12T09:49:45.302082+00:00 app[web.1]: /app/.heroku/python/lib/python3.9/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
2021-06-12T09:49:45.302083+00:00 app[web.1]: return io.open(fd, *args, **kwargs)
2021-06-12T09:49:45.306106+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [7] [INFO] Booting worker with pid: 7
2021-06-12T09:49:45.312314+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [7] [ERROR] Exception in worker process
2021-06-12T09:49:45.312315+00:00 app[web.1]: Traceback (most recent call last):
2021-06-12T09:49:45.312326+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-06-12T09:49:45.312326+00:00 app[web.1]: worker.init_process()
2021-06-12T09:49:45.312327+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 129, in init_process
2021-06-12T09:49:45.312328+00:00 app[web.1]: self.load_wsgi()
2021-06-12T09:49:45.312328+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2021-06-12T09:49:45.312328+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-06-12T09:49:45.312329+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-06-12T09:49:45.312329+00:00 app[web.1]: self.callable = self.load()
2021-06-12T09:49:45.312329+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2021-06-12T09:49:45.312330+00:00 app[web.1]: return self.load_wsgiapp()
2021-06-12T09:49:45.312330+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2021-06-12T09:49:45.312331+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-06-12T09:49:45.312331+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 350, in import_app
2021-06-12T09:49:45.312331+00:00 app[web.1]: __import__(module)
2021-06-12T09:49:45.312332+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_project'
2021-06-12T09:49:45.312475+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [7] [INFO] Worker exiting (pid: 7)
2021-06-12T09:49:45.342275+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [8] [INFO] Booting worker with pid: 8
2021-06-12T09:49:45.354724+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [8] [ERROR] Exception in worker process
2021-06-12T09:49:45.354725+00:00 app[web.1]: Traceback (most recent call last):
2021-06-12T09:49:45.354726+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-06-12T09:49:45.354726+00:00 app[web.1]: worker.init_process()
2021-06-12T09:49:45.354727+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 129, in init_process
2021-06-12T09:49:45.354727+00:00 app[web.1]: self.load_wsgi()
2021-06-12T09:49:45.354728+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2021-06-12T09:49:45.354728+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-06-12T09:49:45.354728+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-06-12T09:49:45.354729+00:00 app[web.1]: self.callable = self.load()
2021-06-12T09:49:45.354729+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2021-06-12T09:49:45.354730+00:00 app[web.1]: return self.load_wsgiapp()
2021-06-12T09:49:45.354730+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2021-06-12T09:49:45.354730+00:00 app[web.1]: return util.import_app(self.app_uri)
2021-06-12T09:49:45.354731+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 350, in import_app
2021-06-12T09:49:45.354731+00:00 app[web.1]: __import__(module)
2021-06-12T09:49:45.354732+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_project'
2021-06-12T09:49:45.354973+00:00 app[web.1]: [2021-06-12 09:49:45 +0000] [8] [INFO] Worker exiting (pid: 8)
2021-06-12T09:49:45.396511+00:00 app[web.1]: Traceback (most recent call last):
2021-06-12T09:49:45.396519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 203, in run
2021-06-12T09:49:45.396872+00:00 app[web.1]: self.manage_workers()
2021-06-12T09:49:45.396873+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 545, in manage_workers
2021-06-12T09:49:45.397354+00:00 app[web.1]: self.spawn_workers()
2021-06-12T09:49:45.397381+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 617, in spawn_workers
2021-06-12T09:49:45.397935+00:00 app[web.1]: time.sleep(0.1 * random.random())
2021-06-12T09:49:45.397962+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2021-06-12T09:49:45.398390+00:00 app[web.1]: self.reap_workers()
2021-06-12T09:49:45.398463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2021-06-12T09:49:45.398958+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2021-06-12T09:49:45.399217+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2021-06-12T09:49:45.399240+00:00 app[web.1]:
2021-06-12T09:49:45.399240+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2021-06-12T09:49:45.399241+00:00 app[web.1]:
2021-06-12T09:49:45.399265+00:00 app[web.1]: Traceback (most recent call last):
2021-06-12T09:49:45.399340+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2021-06-12T09:49:45.399650+00:00 app[web.1]: sys.exit(run())
2021-06-12T09:49:45.399677+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 61, in run
2021-06-12T09:49:45.400017+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2021-06-12T09:49:45.400048+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 223, in run
2021-06-12T09:49:45.400760+00:00 app[web.1]: super(Application, self).run()
2021-06-12T09:49:45.400788+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 72, in run
2021-06-12T09:49:45.401131+00:00 app[web.1]: Arbiter(self).run()
2021-06-12T09:49:45.401164+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 232, in run
2021-06-12T09:49:45.401541+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2021-06-12T09:49:45.401569+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 345, in halt
2021-06-12T09:49:45.402002+00:00 app[web.1]: self.stop()
2021-06-12T09:49:45.402029+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 393, in stop
2021-06-12T09:49:45.402490+00:00 app[web.1]: time.sleep(0.1)
2021-06-12T09:49:45.402519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2021-06-12T09:49:45.403126+00:00 app[web.1]: self.reap_workers()
2021-06-12T09:49:45.403154+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2021-06-12T09:49:45.403652+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2021-06-12T09:49:45.403847+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2021-06-12T09:49:45.504630+00:00 heroku[web.1]: Process exited with status 1
2021-06-12T09:49:45.573000+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-12T09:50:28.064356+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=djangoblog-project.herokuapp.com request_id=55fab425-ef64-485a-892c-cbf2120401ce fwd="223.184.234.62" dyno= connect= service= status=503 bytes= protocol=https
2021-06-12T09:50:28.695891+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=djangoblog-project.herokuapp.com request_id=2c5d885e-39a1-4683-aa17-28efabadd898 fwd="223.184.234.62" dyno= connect= service= status=503 bytes= protocol=https
If you are using django-heroku package than you have to add this in your settings.py
Add the following import statement to the top of settings.py:
import django_heroku
and Then add the following to the bottom of settings.py:
# Activate Django-Heroku.
django_heroku.settings(locals())
check official doc. https://devcenter.heroku.com/articles/django-app-configuration#settings-py-changes
Did you create the Procfile file in the project folder?
If you are using Windows PS, you can type in terminal:
echo web: gunicorn <<YOUR_PROJECT>>.wsgi --log-file - > Procfile
Another possible solution is to use Postgres instead of MySQL:
In settings.py:
DATABASES = {
'default': dj_database_url.config()
}
In requirements.txt:
psycopg2-binary==2.8.6
I'm trying to deploy my first Django app to Heroku. I was able to migrate the database and create a superuser, but now I'm stuck on this:
[2018-05-19 22:51:01 +0000] [4] [INFO] Listening at: http://0.0.0.0:31247 (4)
2018-05-19T22:51:01.283512+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Using worker: sync
2018-05-19T22:51:01.287214+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [INFO] Booting worker with pid: 8
2018-05-19T22:51:01.292792+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [ERROR] Exception in worker process
2018-05-19T22:51:01.292795+00:00 app[web.1]: Traceback (most recent call last):
2018-05-19T22:51:01.292796+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2018-05-19T22:51:01.292797+00:00 app[web.1]: worker.init_process()
2018-05-19T22:51:01.292798+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2018-05-19T22:51:01.292800+00:00 app[web.1]: self.load_wsgi()
2018-05-19T22:51:01.292801+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2018-05-19T22:51:01.292802+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-05-19T22:51:01.292803+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-05-19T22:51:01.292804+00:00 app[web.1]: self.callable = self.load()
2018-05-19T22:51:01.292806+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2018-05-19T22:51:01.292807+00:00 app[web.1]: return self.load_wsgiapp()
2018-05-19T22:51:01.292808+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2018-05-19T22:51:01.292809+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-05-19T22:51:01.292810+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2018-05-19T22:51:01.292811+00:00 app[web.1]: __import__(module)
2018-05-19T22:51:01.292816+00:00 app[web.1]: ModuleNotFoundError: No module named 'whispering-shelf-25150'
2018-05-19T22:51:01.292905+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [INFO] Worker exiting (pid: 8)
2018-05-19T22:51:01.329968+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Shutting down: Master
2018-05-19T22:51:01.330127+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-05-19T22:51:01.413026+00:00 heroku[web.1]: Process exited with status 3
2018-05-19T22:51:07.070132+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=whispering-shelf-25150.herokuapp.com request_id=4b10d0f1-939f-44b6-8ee0-b535cb07f8de fwd="185.5.121.201" dyno= connect= service= status=503 bytes= protocol=https
I developed my application using some tutorials that use mysite in my settings. But now my Heroku app is named whispering-shelf-25150.
What is the relation between those names? For example, should I change every occurence of mysite in settings.py to whispering-shelf-25150?
In my wsgi file I have:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "whispering-shelf-25150.settings.settings")
What is the relation between those names? For example, should I change every occurence of mysite in settings.py to whispering-shelf-25150?
The name of your Heroku app is irrelevant. There is no relationship between it and your Python module names.
The name of your settings module must match what's in your project folder, and the name of the top-level folder doesn't matter.
For example, if your directory tree looks like
project/ ← ignore this
mysite/ ← include this
settings.py ← include this
some_app/
...
your settings module is mysite.settings.
I am getting a Server Error(500) when debug is set to false, But the site works fine when debug=True
This is the Heroku log: [EDIT:NEW LOG FILE AFTER MAKING CHANGES IN DJANGO LOG]
2017-07-30T17:19:06.000000+00:00 app[api]: Build succeeded
2017-07-30T17:19:25.874517+00:00 heroku[web.1]: State changed from up to starting
2017-07-30T17:19:25.873834+00:00 heroku[web.1]: Restarting
2017-07-30T17:19:26.809034+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-07-30T17:19:26.828322+00:00 app[web.1]: [2017-07-30 17:19:26 +0000] [11] [INFO] Worker exiting (pid: 11)
2017-07-30T17:19:26.842100+00:00 app[web.1]: [2017-07-30 17:19:26 +0000] [10] [INFO] Worker exiting (pid: 10)
2017-07-30T17:19:26.852227+00:00 app[web.1]: [2017-07-30 17:19:26 +0000] [4] [INFO] Handling signal: term
2017-07-30T17:19:26.868822+00:00 app[web.1]: [2017-07-30 17:19:26 +0000] [4] [INFO] Shutting down: Master
2017-07-30T17:19:27.014793+00:00 heroku[web.1]: Process exited with status 0
2017-07-30T17:19:30.765424+00:00 heroku[web.1]: Starting process with command `gunicorn techzu.wsgi --log-file -`
2017-07-30T17:19:33.522804+00:00 app[web.1]: [2017-07-30 17:19:33 +0000] [4] [INFO] Starting gunicorn 19.7.1
2017-07-30T17:19:33.523786+00:00 app[web.1]: [2017-07-30 17:19:33 +0000] [4] [INFO] Using worker: sync
2017-07-30T17:19:33.523653+00:00 app[web.1]: [2017-07-30 17:19:33 +0000] [4] [INFO] Listening at: http://0.0.0.0:43129 (4)
2017-07-30T17:19:33.528197+00:00 app[web.1]: [2017-07-30 17:19:33 +0000] [10] [INFO] Booting worker with pid: 10
2017-07-30T17:19:33.549206+00:00 app[web.1]: [2017-07-30 17:19:33 +0000] [11] [INFO] Booting worker with pid: 11
2017-07-30T17:19:34.484665+00:00 heroku[web.1]: State changed from starting to up
2017-07-30T17:20:18.368438+00:00 heroku[router]: at=info method=GET path="/" host=www.tecbux.com request_id=84831c2e-e908-4313-8ea0-3a689a54e3a4 fwd="49.207.184.93" dyno=web.1 connect=0ms service=134ms status=500 bytes=239 protocol=http
2017-07-30T17:20:18.362963+00:00 app[web.1]: Traceback (most recent call last):
2017-07-30T17:20:18.362946+00:00 app[web.1]: Internal Server Error: /
2017-07-30T17:20:18.362964+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner
2017-07-30T17:20:18.362965+00:00 app[web.1]: response = get_response(request)
2017-07-30T17:20:18.362965+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 217, in _get_response
2017-07-30T17:20:18.362967+00:00 app[web.1]: response = self.process_exception_by_middleware(e, request)
2017-07-30T17:20:18.362967+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 215, in _get_response
2017-07-30T17:20:18.362968+00:00 app[web.1]: response = response.render()
2017-07-30T17:20:18.362969+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/response.py", line 109, in render
2017-07-30T17:20:18.362969+00:00 app[web.1]: self.content = self.rendered_content
2017-07-30T17:20:18.362972+00:00 app[web.1]: return self.template.render(context)
2017-07-30T17:20:18.362970+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/response.py", line 86, in rendered_content
2017-07-30T17:20:18.362971+00:00 app[web.1]: content = template.render(context, self._request)
2017-07-30T17:20:18.362971+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/backends/django.py", line 66, in render
2017-07-30T17:20:18.362975+00:00 app[web.1]: return self.nodelist.render(context)
2017-07-30T17:20:18.362973+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py", line 208, in render
2017-07-30T17:20:18.362973+00:00 app[web.1]: return self._render(context)
2017-07-30T17:20:18.362974+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py", line 199, in _render
2017-07-30T17:20:18.362976+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py", line 961, in render_annotated
2017-07-30T17:20:18.362978+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/templatetags/static.py", line 104, in render
2017-07-30T17:20:18.362975+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py", line 994, in render
2017-07-30T17:20:18.362978+00:00 app[web.1]: url = self.url(context)
2017-07-30T17:20:18.362976+00:00 app[web.1]: bit = node.render_annotated(context)
2017-07-30T17:20:18.362980+00:00 app[web.1]: return self.handle_simple(path)
2017-07-30T17:20:18.362977+00:00 app[web.1]: return self.render(context)
2017-07-30T17:20:18.362981+00:00 app[web.1]: return staticfiles_storage.url(path)
2017-07-30T17:20:18.362979+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/templatetags/static.py", line 101, in url
2017-07-30T17:20:18.362981+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/templatetags/static.py", line 114, in handle_simple
2017-07-30T17:20:18.362982+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 132, in url
2017-07-30T17:20:18.362983+00:00 app[web.1]: hashed_name = self.stored_name(clean_name)
2017-07-30T17:20:18.362983+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 292, in stored_name
2017-07-30T17:20:18.362984+00:00 app[web.1]: cache_name = self.clean_name(self.hashed_name(name))
2017-07-30T17:20:18.362985+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 95, in hashed_name
2017-07-30T17:20:18.362985+00:00 app[web.1]: (clean_name, self))
2017-07-30T17:20:18.362988+00:00 app[web.1]: ValueError: The file 'style.css' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7f6decd24b50>.
At first i had an Internal server error, but that was because i did not put my SENDGRID API in my settings.py, After adding that i get SERVER ERROR(500)
This is the settings.py
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = '****'
EMAIL_HOST_PASSWORD = '****'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_BACKEND = "sgbackend.SendGridBackend"
SENDGRID_API_KEY = "***"
ALLOWED_HOSTS = ['www.xxx.com', 'xxx.com']
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
###
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
import dj_database_url
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
MEDIA_URL = '/media/'
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_JQUERY_URL = '//code.jquery.com/jquery-3.1.1.min.js'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'static/media')
The Static files are loaded in Debug=False
This is when i try heroku local web
[WARN] No ENV file found
22:19:44 web.1 | [2017-07-29 22:19:44 +0000] [7476] [INFO] Starting gunicorn 19.7.1
22:19:44 web.1 | [2017-07-29 22:19:44 +0000] [7476] [INFO] Listening at: http://0.0.0.0:5000 (7476)
22:19:44 web.1 | [2017-07-29 22:19:44 +0000] [7476] [INFO] Using worker: sync
22:19:44 web.1 | [2017-07-29 22:19:44 +0000] [7482] [INFO] Booting worker with pid: 7482
I get a BAD REQUEST (400)
PS : So,some of the images are not loading too, could this be an issue with static files? But my CSS loads along with some other images.
[EDIT]The Images That are not loading are the images i upload through django's admin page when it is live. After git push heroku master the images aren't loading.
This is my wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "techzu.settings")
application = get_wsgi_application()
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)
[EDIT : ValueError: The file 'style.css' could not be found with .]
Added this in the settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
},
},
}
Got the errors in the log
Apparently there was a mismatch with the names of the folders in the remote server and my local machine
Try making migrations with:
heroku run python manage.py makemigrations
heroku run python manage.py migrate
I had the same issue, but this solved it.
While turning off Debugging.
You need to provide ALLOWED_HOSTS in a list. Please check Django documentation for more..
Debug = False
ALLOWED_HOSTS = ['xyz.com']
You can't use SQLite3 on Heroku. Switch to Postgres.
You need to provide ALLOWED_HOSTS
Debug = False
ALLOWED_HOSTS = [".herokuapp.com"]
And Heroku you should use PostgreSQL
https://github.com/kennethreitz/dj-database-url
In my case it was due to conflict between
django staticfiles and django _heroku staticfiles
I had to disable one of them.
Either do this,
` INSTALLED_APPS={
.
.
#django.contrib.staticfiles,
}
django_heroku.settings(locals())` #in end of settings.py
Or do this
`INSTALLED_APPS={
.
.
django.contrib.staticfiles,
}
django_heroku.settings(locals(),staticfiles=False)` #in end of settings.py
Or if you are using whitenoise ,disable staticfiles for both django and django_heroku.