I'm using GitHub and Heroku to run my Django app. The app works as expected locally but I'm running into problems when pushing (via GitHub) it up to Heroku. I think I boiled it down to something not working with requirements.txt or the general pip set up. Specifically, I've been trying to install Django-Bootstrap4. It is in the requirements file.
I definitely don't understand this process and I very well might not even be asking the right questions. But I've tried following all of the documentation found here: https://devcenter.heroku.com/articles/python-pip.
When I'm in the virtual environment locally, everything looks fine. Then after doing:
> heroku login
> heroku run pip install django-bootstrap4 (or pip or pandas)
It seems to install, but then running:
> heroku run pip list
nothing has changed. TIA
requirements.txt
certifi==2018.8.24
chardet==3.0.4
dj-database-url==0.5.0
Django==2.1.2
django-bootstrap4==0.0.7
django-heroku==0.3.1
django-registration-redux==2.5
gunicorn==19.9.0
idna==2.7
psycopg2==2.7.5
pytz==2018.5
requests==2.19.1
urllib3==1.23
whitenoise==4.1
Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.6"
Adding Log:
2018-11-06T02:34:49.915341+00:00 app[web.1]: Traceback (most recent call last):
2018-11-06T02:34:49.915343+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2018-11-06T02:34:49.915345+00:00 app[web.1]: worker.init_process()
2018-11-06T02:34:49.915346+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2018-11-06T02:34:49.915347+00:00 app[web.1]: self.load_wsgi()
2018-11-06T02:34:49.915349+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2018-11-06T02:34:49.915350+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-11-06T02:34:49.915351+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-11-06T02:34:49.915352+00:00 app[web.1]: self.callable = self.load()
2018-11-06T02:34:49.915354+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2018-11-06T02:34:49.915355+00:00 app[web.1]: return self.load_wsgiapp()
2018-11-06T02:34:49.915356+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2018-11-06T02:34:49.915357+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-11-06T02:34:49.915358+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2018-11-06T02:34:49.915359+00:00 app[web.1]: __import__(module)
2018-11-06T02:34:49.915360+00:00 app[web.1]: File "/app/app/wsgi.py", line 7, in <module>
2018-11-06T02:34:49.915362+00:00 app[web.1]: application = get_wsgi_application()
2018-11-06T02:34:49.915363+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-11-06T02:34:49.915364+00:00 app[web.1]: django.setup(set_prefix=False)
2018-11-06T02:34:49.915365+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
2018-11-06T02:34:49.915366+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2018-11-06T02:34:49.915367+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
2018-11-06T02:34:49.915368+00:00 app[web.1]: app_config = AppConfig.create(entry)
2018-11-06T02:34:49.915369+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
2018-11-06T02:34:49.915370+00:00 app[web.1]: module = import_module(entry)
2018-11-06T02:34:49.915372+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-11-06T02:34:49.915373+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2018-11-06T02:34:49.915426+00:00 app[web.1]: ModuleNotFoundError: No module named 'bootstrap4'
2018-11-06T02:34:49.915794+00:00 app[web.1]: [2018-11-06 02:34:49 +0000] [11] [INFO] Worker exiting (pid: 11)
2018-11-06T02:34:49.919437+00:00 app[web.1]: [2018-11-06 02:34:49 +0000] [10] [ERROR] Exception in worker process
2018-11-06T02:34:49.919439+00:00 app[web.1]: Traceback (most recent call last):
2018-11-06T02:34:49.919441+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2018-11-06T02:34:49.919443+00:00 app[web.1]: worker.init_process()
2018-11-06T02:34:49.919444+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2018-11-06T02:34:49.919446+00:00 app[web.1]: self.load_wsgi()
2018-11-06T02:34:49.919447+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2018-11-06T02:34:49.919448+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-11-06T02:34:49.919450+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-11-06T02:34:49.919451+00:00 app[web.1]: self.callable = self.load()
2018-11-06T02:34:49.919453+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2018-11-06T02:34:49.919454+00:00 app[web.1]: return self.load_wsgiapp()
2018-11-06T02:34:49.919456+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2018-11-06T02:34:49.919458+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-11-06T02:34:49.919459+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2018-11-06T02:34:49.919461+00:00 app[web.1]: __import__(module)
2018-11-06T02:34:49.919462+00:00 app[web.1]: File "/app/app/wsgi.py", line 7, in <module>
2018-11-06T02:34:49.919464+00:00 app[web.1]: application = get_wsgi_application()
2018-11-06T02:34:49.919465+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-11-06T02:34:49.919467+00:00 app[web.1]: django.setup(set_prefix=False)
2018-11-06T02:34:49.919469+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
2018-11-06T02:34:49.919470+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2018-11-06T02:34:49.919472+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
2018-11-06T02:34:49.919473+00:00 app[web.1]: app_config = AppConfig.create(entry)
2018-11-06T02:34:49.919474+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
2018-11-06T02:34:49.919476+00:00 app[web.1]: module = import_module(entry)
2018-11-06T02:34:49.919477+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-11-06T02:34:49.919479+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2018-11-06T02:34:49.919480+00:00 app[web.1]: ModuleNotFoundError: No module named 'bootstrap4'
2018-11-06T02:34:49.920093+00:00 app[web.1]: [2018-11-06 02:34:49 +0000] [10] [INFO] Worker exiting (pid: 10)
2018-11-06T02:34:50.079130+00:00 app[web.1]: [2018-11-06 02:34:50 +0000] [4] [INFO] Shutting down: Master
2018-11-06T02:34:50.079281+00:00 app[web.1]: [2018-11-06 02:34:50 +0000] [4] [INFO] Reason: Worker failed to boot.
heroku run creates an one-off Dyno and runs your command in it, your changes wouldn't be persisted.
You actually don't need to pip install yourself. Doc here
To specify Python package dependencies on Heroku via pip, add a pip
requirements file named requirements.txt to the root of your
repository.
First, run pip install django-bootstrap4
Secondly, run pip freeze > requirements.txt
Then add and commit - git add requirements.txt && git commit -m 'added django-bootstrap4 && git push heroku master
This will install the package in your Heroku app.
This solved my problem: https://stackoverflow.com/a/52821649/4490230
Something about an issue running the latest version of pipenv with pip. Specifically, I had to downgrade not only in the virtual environment but the root as well.
Related
I was going to host it using Heroku. But it does not work because of the problem with the profile.
This my Procfile
web: gunicorn onlineMenu.wsgi --log-file -
my wsgi.py code
"""
WSGI config for onlineMenu project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineMenu.settings')
application = get_wsgi_application()
this is my Heroku log (not all)
2020-10-23T16:04:08.861587+00:00 app[web.1]: Traceback (most recent
call last): 2020-10-23T16:04:08.861588+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/arbiter.py",
line 583, in spawn_worker 2020-10-23T16:04:08.861588+00:00 app[web.1]:
worker.init_process() 2020-10-23T16:04:08.861589+00:00 app[web.1]:
File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py",
line 119, in init_process 2020-10-23T16:04:08.861589+00:00 app[web.1]:
self.load_wsgi() 2020-10-23T16:04:08.861589+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/base.py",
line 144, in load_wsgi 2020-10-23T16:04:08.861590+00:00 app[web.1]:
self.wsgi = self.app.wsgi() 2020-10-23T16:04:08.861590+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/base.py",
line 67, in wsgi 2020-10-23T16:04:08.861590+00:00 app[web.1]:
self.callable = self.load() 2020-10-23T16:04:08.861591+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py",
line 49, in load 2020-10-23T16:04:08.861591+00:00 app[web.1]: return
self.load_wsgiapp() 2020-10-23T16:04:08.861591+00:00 app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py",
line 39, in load_wsgiapp 2020-10-23T16:04:08.861592+00:00 app[web.1]:
return util.import_app(self.app_uri) 2020-10-23T16:04:08.861592+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/site-packages/gunicorn/util.py",
line 358, in import_app 2020-10-23T16:04:08.861592+00:00 app[web.1]:
mod = importlib.import_module(module) 2020-10-23T16:04:08.861593+00:00
app[web.1]: File
"/app/.heroku/python/lib/python3.8/importlib/init.py", line 127,
in import_module 2020-10-23T16:04:08.861593+00:00 app[web.1]: return
_bootstrap._gcd_import(name[level:], package, level) 2020-10-23T16:04:08.861593+00:00 app[web.1]: File "", line 1014, in _gcd_import
2020-10-23T16:04:08.861594+00:00 app[web.1]: File "", line 991, in _find_and_load
2020-10-23T16:04:08.861594+00:00 app[web.1]: File "", line 973, in _find_and_load_unlocked
2020-10-23T16:04:08.861594+00:00 app[web.1]: ModuleNotFoundError: No
module named 'onlineMenu/wsgi' 2020-10-23T16:04:08.861841+00:00
app[web.1]: [2020-10-23 16:04:08 +0000] [10] [INFO] Worker exiting
(pid: 10) 2020-10-23T16:04:09.011977+00:00 app[web.1]: [2020-10-23
16:04:09 +0000] [4] [INFO] Shutting down: Master
2020-10-23T16:04:09.012166+00:00 app[web.1]: [2020-10-23 16:04:09
+0000] [4] [INFO] Reason: Worker failed to boot.
I am deploying the polls app from django tutorial to heroku.
My project seen from Pycharm have the following distribution:
My requirements file looks as:
Django==2.0.5
scikit-learn==0.19.1
numpy==1.13.3
pandas==0.22.0
pymysql==0.8.1
gunicorn==19.0.0
Runtime as:
python-3.6.5
Procfile as:
web: gunicorn inf-shf-373.wsgi:application --log-file -
When I deploy the app and goes to the browser I get an application error that says:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
I retrieve the log using the heroku logs --tail --app inf-shf-373
statement.
Log
2018-06-15T10:08:51.529196+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-06-15T10:08:51.529198+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2018-06-15T10:08:51.529201+00:00 app[web.1]: ModuleNotFoundError: No module named 'inf-shf-373'
2018-06-15T10:08:51.529199+00:00 app[web.1]: __import__(module)
2018-06-15T10:08:51.529202+00:00 app[web.1]: Traceback (most recent call last):
2018-06-15T10:08:51.529203+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 502, in spawn_worker
2018-06-15T10:08:51.529205+00:00 app[web.1]: worker.init_process()
2018-06-15T10:08:51.529206+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 114, in init_process
2018-06-15T10:08:51.529208+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-06-15T10:08:51.529209+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 66, in wsgi
2018-06-15T10:08:51.529211+00:00 app[web.1]: self.callable = self.load()
2018-06-15T10:08:51.529212+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-06-15T10:08:51.529216+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-06-15T10:08:51.529214+00:00 app[web.1]: return self.load_wsgiapp()
2018-06-15T10:08:51.529218+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-06-15T10:08:51.529219+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2018-06-15T10:08:51.529221+00:00 app[web.1]: __import__(module)
2018-06-15T10:08:51.529222+00:00 app[web.1]: ModuleNotFoundError: No module named 'inf-shf-373'
2018-06-15T10:08:51.529340+00:00 app[web.1]: 2018-06-15 10:08:51 [8] [INFO] Worker exiting (pid: 8)
2018-06-15T10:08:51.568925+00:00 app[web.1]: Traceback (most recent call last):
2018-06-15T10:08:51.568993+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2018-06-15T10:08:51.569405+00:00 app[web.1]: load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')()
2018-06-15T10:08:51.569437+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2018-06-15T10:08:51.569696+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2018-06-15T10:08:51.569725+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 166, in run
2018-06-15T10:08:51.570022+00:00 app[web.1]: super(Application, self).run()
2018-06-15T10:08:51.570050+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 71, in run
2018-06-15T10:08:51.570255+00:00 app[web.1]: Arbiter(self).run()
2018-06-15T10:08:51.570283+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 169, in run
2018-06-15T10:08:51.570559+00:00 app[web.1]: self.manage_workers()
2018-06-15T10:08:51.570587+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
2018-06-15T10:08:51.571398+00:00 app[web.1]: self.spawn_workers()
2018-06-15T10:08:51.571426+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 537, in spawn_workers
2018-06-15T10:08:51.572443+00:00 app[web.1]: time.sleep(0.1 * random.random())
2018-06-15T10:08:51.572572+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in handle_chld
2018-06-15T10:08:51.573025+00:00 app[web.1]: self.reap_workers()
2018-06-15T10:08:51.573611+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 459, in reap_workers
2018-06-15T10:08:51.574215+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2018-06-15T10:08:51.574320+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2018-06-15T10:08:51.656203+00:00 heroku[web.1]: Process exited with status 1
2018-06-15T10:08:51.766089+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-15T10:08:51.768196+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-15T10:08:59.756644+00:00 heroku[web.1]: Starting process with command `gunicorn inf-shf-373.wsgi:application --log-file -`
2018-06-15T10:09:01.853255+00:00 heroku[web.1]: Process exited with status 1
2018-06-15T10:09:01.754462+00:00 app[web.1]: 2018-06-15 10:09:01 [4] [INFO] Starting gunicorn 19.0.0
2018-06-15T10:09:01.754969+00:00 app[web.1]: 2018-06-15 10:09:01 [4] [INFO] Listening at: http://0.0.0.0:24374 (4)
2018-06-15T10:09:01.755073+00:00 app[web.1]: 2018-06-15 10:09:01 [4] [INFO] Using worker: sync
2018-06-15T10:09:01.758731+00:00 app[web.1]: 2018-06-15 10:09:01 [8] [INFO] Booting worker with pid: 8
2018-06-15T10:09:01.762508+00:00 app[web.1]: 2018-06-15 10:09:01 [8] [ERROR] Exception in worker process:
2018-06-15T10:09:01.762510+00:00 app[web.1]: Traceback (most recent call last):
2018-06-15T10:09:01.762511+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 502, in spawn_worker
2018-06-15T10:09:01.762513+00:00 app[web.1]: worker.init_process()
2018-06-15T10:09:01.762514+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 114, in init_process
2018-06-15T10:09:01.762515+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-06-15T10:09:01.762516+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 66, in wsgi
2018-06-15T10:09:01.762517+00:00 app[web.1]: self.callable = self.load()
2018-06-15T10:09:01.762519+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-06-15T10:09:01.762520+00:00 app[web.1]: return self.load_wsgiapp()
2018-06-15T10:09:01.762521+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-06-15T10:09:01.762522+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-06-15T10:09:01.762523+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2018-06-15T10:09:01.762524+00:00 app[web.1]: __import__(module)
2018-06-15T10:09:01.762525+00:00 app[web.1]: ModuleNotFoundError: No module named 'inf-shf-373'
2018-06-15T10:09:01.762526+00:00 app[web.1]: Traceback (most recent call last):
2018-06-15T10:09:01.762527+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 502, in spawn_worker
2018-06-15T10:09:01.762528+00:00 app[web.1]: worker.init_process()
2018-06-15T10:09:01.762529+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 114, in init_process
2018-06-15T10:09:01.762530+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-06-15T10:09:01.762532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 66, in wsgi
2018-06-15T10:09:01.762533+00:00 app[web.1]: self.callable = self.load()
2018-06-15T10:09:01.762534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-06-15T10:09:01.762535+00:00 app[web.1]: return self.load_wsgiapp()
2018-06-15T10:09:01.762536+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-06-15T10:09:01.762537+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-06-15T10:09:01.762538+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2018-06-15T10:09:01.762543+00:00 app[web.1]: ModuleNotFoundError: No module named 'inf-shf-373'
2018-06-15T10:09:01.762539+00:00 app[web.1]: __import__(module)
2018-06-15T10:09:01.762635+00:00 app[web.1]: 2018-06-15 10:09:01 [8] [INFO] Worker exiting (pid: 8)
2018-06-15T10:09:01.790830+00:00 app[web.1]: Traceback (most recent call last):
2018-06-15T10:09:01.790840+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2018-06-15T10:09:01.791070+00:00 app[web.1]: load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')()
2018-06-15T10:09:01.791073+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2018-06-15T10:09:01.791209+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2018-06-15T10:09:01.791216+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 166, in run
2018-06-15T10:09:01.791357+00:00 app[web.1]: super(Application, self).run()
2018-06-15T10:09:01.791360+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 71, in run
2018-06-15T10:09:01.791467+00:00 app[web.1]: Arbiter(self).run()
2018-06-15T10:09:01.791470+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 169, in run
2018-06-15T10:09:01.791600+00:00 app[web.1]: self.manage_workers()
2018-06-15T10:09:01.791603+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
2018-06-15T10:09:01.791814+00:00 app[web.1]: self.spawn_workers()
2018-06-15T10:09:01.791816+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 537, in spawn_workers
2018-06-15T10:09:01.792051+00:00 app[web.1]: time.sleep(0.1 * random.random())
2018-06-15T10:09:01.792055+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in handle_chld
2018-06-15T10:09:01.792184+00:00 app[web.1]: self.reap_workers()
2018-06-15T10:09:01.792187+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 459, in reap_workers
2018-06-15T10:09:01.792383+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2018-06-15T10:09:01.792417+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2018-06-15T10:09:01.897234+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-15T10:09:15.812856+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=inf-shf-373.herokuapp.com request_id=32838b77-14c1-4235-8ac1-9823f14dab4b fwd="80.94.4.53" dyno= connect= service= status=503 bytes= protocol=https
I believe that setting.py at my project directory doesn't have an app called inf-shf-373, but it is the random name created by heroku. This means that my whole app name, and then the references at Procfile should be surveys (I changed the polls name to surveys despite the tutorial).
Any reference to what is the problem?
EDIT
Answering DanielRoseman:
The wsgi.py file is at: code/computationalMarketing/computationalMarketing/wsgi.py
Extra information:
Is it possible that the problem can be that the wsgi.py file is not in the main path of the repo? The django project is the first computationalMarketing folder (this project is all gathered at code folder), the other folders that exists at the same level are sql mods, and vagrant files.
Finally I have been able to solve this question.
I have found the parameter chdir at gunicorn, which stablish the path to the wsgi.py file at django app.
An example:
web: gunicorn --chdir code/computationalMarketing computationalMarketing.wsgi --log-file -
Getting a stack of errors concluding to
"ImportError: No module named webpack_loader".
I have a Django app created that I'm trying to Docker using Gunicorn.
My Dockerfile and start.sh are in a root directory alongside another directory called approot. In approot is everything you'd expect to see from running django-admin startproject. My wsgi.py file is in a directory called app inside of approot.
Here is my...
requirements.txt:
Django>=1.8
gunicorn==19.6.0
Dockerfile:
#Dockerfile
# FROM directive instructing base image to build upon
FROM python:2-onbuild
# COPY startup script into known file location in container
COPY start.sh /start.sh
# EXPOSE port 8000 to allow communication to/from server
EXPOSE 8000
# CMD specifies the command to execute to start the server running
CMD ["/start.sh"]
start.sh:
#!/bin/bash
echo Starting Gunicorn.
cd approot
exec gunicorn app.wsgi:application \
--bind 0.0.0.0:8000 \
--workers 3
My settings.py includes:
INSTALLED_APPS = [
...,
'webpack_loader'
]
WSGI_APPLICATION = 'app.wsgi.application'
WEBPACK_LOADER = {
'DEFAULT': {
'CACHE': not DEBUG,
'BUNDLE_DIR_NAME': 'bundles/',
'STATS_FILE': join(PROJECT_ROOT, 'webpack-stats.json'),
'POLL_INTERVAL': 0.1,
'TIMEOUT': None,
}
}
error stack is
$ docker run -it -p 8000:8000 app
Starting Gunicorn.
[2017-10-31 02:23:31 +0000] [1] [INFO] Starting gunicorn 19.6.0
[2017-10-31 02:23:31 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2017-10-31 02:23:31 +0000] [1] [INFO] Using worker: sync
[2017-10-31 02:23:31 +0000] [8] [INFO] Booting worker with pid: 8
[2017-10-31 02:23:31 +0000] [9] [INFO] Booting worker with pid: 9
[2017-10-31 02:23:31 +0000] [12] [INFO] Booting worker with pid: 12
[2017-10-31 02:23:31 +0000] [8] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
__import__(module)
File "/usr/src/app/approot/app/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/usr/local/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named webpack_loader
[2017-10-31 02:23:31 +0000] [8] [INFO] Worker exiting (pid: 8)
[2017-10-31 02:23:31 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
__import__(module)
File "/usr/src/app/approot/app/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/usr/local/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named webpack_loader
[2017-10-31 02:23:31 +0000] [9] [INFO] Worker exiting (pid: 9)
Traceback (most recent call last):
File "/usr/local/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 192, in run
super(Application, self).run()
File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
Arbiter(self).run()
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 218, in run
self.halt(reason=inst.reason, exit_status=inst.exit_status)
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 331, in halt
self.stop()
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 381, in stop
time.sleep(0.1)
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 231, in handle_chld
self.reap_workers()
File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 506, in reap_workers
raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
I think you're missing the django-webpack-loader in the requirements.txt
I have Been using this guide Getting Started with Django on Heroku
requirements.txt
dj-database-url==0.3.0
dj-static==0.0.6
Django==1.7.7
django-toolbelt==0.0.1
djrill==1.3.0
gunicorn==19.3.0
Pillow==2.7.0
psycopg2==2.6
requests==2.6.0
static3==0.5.1
Procfile
web: gunicorn MY_DJANGO_APP.wsgi --log-file -
wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MY_DJANGO_APP.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())
Heroku log
State changed from crashed to starting
heroku[web.1]: Starting process with command `gunicorn MY_Django_App.wsgi --log-file -`
app[web.1]: [2015-03-29 07:17:55 +0000] [3] [INFO] Starting gunicorn 19.3.0
app[web.1]: [2015-03-29 07:17:56 +0000] [8] [INFO] Booting worker with pid: 8
app[web.1]: [2015-03-29 07:17:55 +0000] [3] [INFO] Listening at: http://0.0.0.0:17329 (3)
app[web.1]: [2015-03-29 07:17:55 +0000] [3] [INFO] Using worker: sync
app[web.1]: [2015-03-29 07:17:55 +0000] [7] [INFO] Booting worker with pid: 7
heroku[web.1]: State changed from starting to up
app[web.1]: [2015-03-29 07:17:56 +0000] [8] [ERROR] Exception in worker process:
app[web.1]: self.callable = self.load()
app[web.1]: return util.import_app(self.app_uri)
app[web.1]: File "/app/MY_Django_App/wsgi.py", line 17, in <module>
app[web.1]: Traceback (most recent call last):
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/base.py", line 118, in init_process
app[web.1]: Traceback (most recent call last):
app[web.1]: worker.init_process()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/base.py", line 118, in init_process
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/dj_static.py", line 48, in __init__
app[web.1]: AttributeError: 'module' object has no attribute 'Cling'
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
app[web.1]: return self.load_wsgiapp()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/dj_static.py", line 48, in __init__
app[web.1]: self.wsgi = self.app.wsgi()
app[web.1]: return self.load_wsgiapp()
app[web.1]: __import__(module)
app[web.1]: application = Cling(get_wsgi_application())
app[web.1]: AttributeError: 'module' object has no attribute 'Cling'
app[web.1]: application = Cling(get_wsgi_application())
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/base.py", line 67, in wsgi
app[web.1]: return util.import_app(self.app_uri)
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/util.py", line 355, in import_app
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
app[web.1]: self.wsgi = self.app.wsgi()
app[web.1]: __import__(module)
app[web.1]: self.cling = static.Cling(base_dir)
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
app[web.1]: [2015-03-29 07:17:56 +0000] [8] [INFO] Worker exiting (pid: 8)
app[web.1]: worker.init_process()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/base.py", line 67, in wsgi
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
app[web.1]: self.callable = self.load()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/util.py", line 355, in import_app
app[web.1]: File "/app/MY_Django_App/wsgi.py", line 17, in <module>
app[web.1]: self.cling = static.Cling(base_dir)
app[web.1]: [2015-03-29 07:17:56 +0000] [7] [ERROR] Exception in worker process:
app[web.1]: worker.init_process()
app[web.1]: return self.load_wsgiapp()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/dj_static.py", line 48, in __init__
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/util.py", line 355, in import_app
app[web.1]: File "/app/MY_Django_App/wsgi.py", line 17, in <module>
app[web.1]: Traceback (most recent call last):
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/base.py", line 118, in init_process
app[web.1]: __import__(module)
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
app[web.1]: __import__(module)
app[web.1]: self.cling = static.Cling(base_dir)
app[web.1]: return self.load_wsgiapp()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/base.py", line 67, in wsgi
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/util.py", line 355, in import_app
app[web.1]: worker.init_process()
app[web.1]: self.callable = self.load()
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
app[web.1]: AttributeError: 'module' object has no attribute 'Cling'
app[web.1]: [2015-03-29 07:17:56 +0000] [3] [INFO] Shutting down: Master
app[web.1]: [2015-03-29 07:17:56 +0000] [3] [INFO] Reason: Worker failed to boot.
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/base.py", line 67, in wsgi
app[web.1]: self.cling = static.Cling(base_dir)
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
app[web.1]: File "/app/MY_Django_App/wsgi.py", line 17, in <module>
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/workers/base.py", line 118, in init_process
app[web.1]: self.callable = self.load()
app[web.1]: AttributeError: 'module' object has no attribute 'Cling'
app[web.1]: return util.import_app(self.app_uri)
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/dj_static.py", line 48, in __init__
app[web.1]: self.wsgi = self.app.wsgi()
app[web.1]: return util.import_app(self.app_uri)
app[web.1]: Traceback (most recent call last):
app[web.1]: File "/app/.heroku/python/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
app[web.1]: application = Cling(get_wsgi_application())
app[web.1]: application = Cling(get_wsgi_application())
app[web.1]: self.wsgi = self.app.wsgi()
app[web.1]: [2015-03-29 07:17:56 +0000] [7] [INFO] Worker exiting (pid: 7)
heroku[web.1]: State changed from up to crashed
heroku[web.1]: Process exited with status 3
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/feed" host=MY_Django_App.herokuapp.com request_id=e6de6503-58ea-4a05-b8fc-20321ace144a fwd="91.133.185.43" dyno=web.1 connect=5000ms service= status=503 bytes=
The more eye catching error
app[web.1]: self.wsgi = self.app.wsgi()
app[web.1]: return self.load_wsgiapp()
app[web.1]: __import__(module)
app[web.1]: application = Cling(get_wsgi_application())
app[web.1]: AttributeError: 'module' object has no attribute 'Cling'
app[web.1]: application = Cling(get_wsgi_application())
What should I do with the Cling thing error? Is there anything I have missed while the project setup?
The error itself means that something is calling a method or getting an attribute on a python module instead of the class within the module.
This could happen if your module filename is the same as the class inside. Ie if you had cling.py and inside was a python class called cling.
Im not really up on python3 and I'm not sure whats causing this, I'm tempted to say it might be a circular dependency issue, or maybe one of the dependencies of dj-static ie static has been updated and caused this issue?
Maybe try to specify only dj-static in your requirements and remove the dependency on static as I believe dj-static should resolve its dependency on static by itself and that may be causing a conflict.
The documentation on heroku could be out of date.
I started using DjangoWhiteNoise instead of dj-static and no more problems.
In my case, I had an extraneous __init__.pyc in a subdirectory, where it shouldn't be. (Reason: as I moved modules around, the __init__.py was correctly deleted, but the compiled __init__.pyc had been left behind.)
Django's autodiscover then threw this error.
Deleting the unwanted __init__.pyc file fixed it.
I am trying to deploy my Django website onto Heroku but when I load my site, I get this error:
Application Error:
An error occurred in the application and your page could not be
served. Please try again in a few moments.
If you are the application owner, check your logs for details.
So I type heroku logs and this is what I got:
2015-02-20T15:49:36.361800+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 116, in init_process
2015-02-20T15:49:36.361809+00:00 app[web.1]: return util.import_app(self.app_uri)
2015-02-20T15:49:36.361801+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2015-02-20T15:49:36.361803+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-02-20T15:49:36.361805+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-02-20T15:49:36.361808+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-02-20T15:49:36.361811+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-02-20T15:49:36.361815+00:00 app[web.1]: application = get_wsgi_application()
2015-02-20T15:49:36.361817+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-02-20T15:49:36.361812+00:00 app[web.1]: __import__(module)
2015-02-20T15:49:36.361819+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
2015-02-20T15:49:36.361814+00:00 app[web.1]: File "/app/django_test/wsgi.py", line 14, in <module>
2015-02-20T15:49:36.361818+00:00 app[web.1]: django.setup()
2015-02-20T15:49:36.361823+00:00 app[web.1]: logging_config_func(logging_settings)
2015-02-20T15:49:36.361821+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-02-20T15:49:36.361822+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/log.py", line 87, in configure_logging
2015-02-20T15:49:36.361829+00:00 app[web.1]: '%r: %s' % (name, e))
2015-02-20T15:49:36.361830+00:00 app[web.1]: ValueError: Unable to configure handler 'default': [Errno 2] No such file or directory: '/app/logs/mylog.log'
2015-02-20T15:49:36.361929+00:00 app[web.1]: [2015-02-20 15:49:36 +0000] [9] [INFO] Worker exiting (pid: 9)
2015-02-20T15:49:36.361825+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 794, in dictConfig
2015-02-20T15:49:36.361828+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 576, in configure
2015-02-20T15:49:36.361826+00:00 app[web.1]: dictConfigClass(config).configure()
2015-02-20T15:49:36.488086+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 503, in spawn_worker
2015-02-20T15:49:36.488087+00:00 app[web.1]: worker.init_process()
2015-02-20T15:49:36.488090+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2015-02-20T15:49:36.488092+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-02-20T15:49:36.488093+00:00 app[web.1]: self.callable = self.load()
2015-02-20T15:49:36.488089+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 116, in init_process
2015-02-20T15:49:36.488103+00:00 app[web.1]: File "/app/django_test/wsgi.py", line 14, in <module>
2015-02-20T15:49:36.488099+00:00 app[web.1]: return util.import_app(self.app_uri)
2015-02-20T15:49:36.488100+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-02-20T15:49:36.488101+00:00 app[web.1]: __import__(module)
2015-02-20T15:49:36.488082+00:00 app[web.1]: [2015-02-20 15:49:36 +0000] [10] [ERROR] Exception in worker process:
2015-02-20T15:49:36.488076+00:00 app[web.1]: /app/static/
2015-02-20T15:49:36.488084+00:00 app[web.1]: Traceback (most recent call last):
2015-02-20T15:49:36.488106+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-02-20T15:49:36.488108+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
2015-02-20T15:49:36.488131+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 576, in configure
2015-02-20T15:49:36.488111+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/log.py", line 87, in configure_logging
2015-02-20T15:49:36.488113+00:00 app[web.1]: logging_config_func(logging_settings)
2015-02-20T15:49:36.488095+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-02-20T15:49:36.488133+00:00 app[web.1]: ValueError: Unable to configure handler 'default': [Errno 2] No such file or directory: '/app/logs/mylog.log'
2015-02-20T15:49:36.488140+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2015-02-20T15:49:36.488136+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 503, in spawn_worker
2015-02-20T15:49:36.488096+00:00 app[web.1]: return self.load_wsgiapp()
2015-02-20T15:49:36.488141+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2015-02-20T15:49:36.488143+00:00 app[web.1]: self.callable = self.load()
2015-02-20T15:49:36.488097+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-02-20T15:49:36.488148+00:00 app[web.1]: return util.import_app(self.app_uri)
2015-02-20T15:49:36.488104+00:00 app[web.1]: application = get_wsgi_application()
2015-02-20T15:49:36.488153+00:00 app[web.1]: File "/app/django_test/wsgi.py", line 14, in <module>
2015-02-20T15:49:36.488110+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-02-20T15:49:36.488158+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
2015-02-20T15:49:36.488157+00:00 app[web.1]: django.setup()
2015-02-20T15:49:36.488160+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-02-20T15:49:36.488150+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
2015-02-20T15:49:36.488107+00:00 app[web.1]: django.setup()
2015-02-20T15:49:36.488151+00:00 app[web.1]: __import__(module)
2015-02-20T15:49:36.488163+00:00 app[web.1]: logging_config_func(logging_settings)
2015-02-20T15:49:36.488114+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 794, in dictConfig
2015-02-20T15:49:36.488132+00:00 app[web.1]: '%r: %s' % (name, e))
2015-02-20T15:49:36.488129+00:00 app[web.1]: dictConfigClass(config).configure()
2015-02-20T15:49:36.488164+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 794, in dictConfig
2015-02-20T15:49:36.488165+00:00 app[web.1]: dictConfigClass(config).configure()
2015-02-20T15:49:36.488168+00:00 app[web.1]: '%r: %s' % (name, e))
2015-02-20T15:49:36.488139+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 116, in init_process
2015-02-20T15:49:36.488135+00:00 app[web.1]: Traceback (most recent call last):
2015-02-20T15:49:36.488137+00:00 app[web.1]: worker.init_process()
2015-02-20T15:49:36.488167+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/logging/config.py", line 576, in configure
2015-02-20T15:49:36.507131+00:00 app[web.1]: super(Application, self).run()
2015-02-20T15:49:36.507076+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 189, in run
2015-02-20T15:49:36.488146+00:00 app[web.1]: return self.load_wsgiapp()
2015-02-20T15:49:36.488144+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-02-20T15:49:36.507001+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2015-02-20T15:49:36.506915+00:00 app[web.1]: Traceback (most recent call last):
2015-02-20T15:49:36.506970+00:00 app[web.1]: sys.exit(run())
2015-02-20T15:49:36.507154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2015-02-20T15:49:36.507531+00:00 app[web.1]: self.reap_workers()
2015-02-20T15:49:36.507476+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 210, in handle_chld
2015-02-20T15:49:36.507269+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2015-02-20T15:49:36.488147+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-02-20T15:49:36.488154+00:00 app[web.1]: application = get_wsgi_application()
2015-02-20T15:49:36.488171+00:00 app[web.1]: [2015-02-20 15:49:36 +0000] [10] [INFO] Worker exiting (pid: 10)
2015-02-20T15:49:36.507190+00:00 app[web.1]: Arbiter(self).run()
2015-02-20T15:49:36.507453+00:00 app[web.1]: time.sleep(0.1)
2015-02-20T15:49:36.507056+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2015-02-20T15:49:36.507382+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 338, in stop
2015-02-20T15:49:36.507715+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2015-02-20T15:49:36.488161+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/log.py", line 87, in configure_logging
2015-02-20T15:49:36.488170+00:00 app[web.1]: ValueError: Unable to configure handler 'default': [Errno 2] No such file or directory: '/app/logs/mylog.log'
2015-02-20T15:49:36.507292+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 293, in halt
2015-02-20T15:49:36.507213+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 197, in run
2015-02-20T15:49:36.507642+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2015-02-20T15:49:36.507358+00:00 app[web.1]: self.stop()
2015-02-20T15:49:36.488155+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-02-20T15:49:36.506923+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 11, in <module>
2015-02-20T15:49:36.507554+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 455, in reap_workers
2015-02-20T15:49:37.304329+00:00 heroku[web.1]: State changed from up to crashed
2015-02-20T15:49:37.292485+00:00 heroku[web.1]: Process exited with status 1
2015-02-20T15:49:36.299215+00:00 heroku[web.1]: State changed from starting to up
2015-02-20T15:49:42.613930+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=article-django.herokuapp.com request_id=5e18c64f-98b1-4f2b-a88b-c9d93a0908e9 fwd="173.3.238.36" dyno=web.1 connect=5001ms service= status=503 bytes=
I looked at this log and it seems like the main problem is something with '/app/logs/mylog.log' not existing. If that's the case, how I do I create that file?
Edit: Here is the LOGGING section of my settings.py file:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins':{
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'email_backend':
'django.core.mail.backends.filebased.EmailBackend',
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propogate': True,
},
}
}
/app is directory in which your application is put on Heroku. Try to add logs directory in root of your project and push it to Heroku - directory will then exist so log file should be created without problems.