python - Application Error While Deploying with Django 1.8 -


i'm deploying project heroku, create app push heroku, adjust postgresql credentials, migrate db, when "run heroku open", shows me: application error page not served.

project structure:

├── apps │   ├── home │   ├── __init__.py │   ├── __init__.pyc │   ├── inventario │   ├── ordenes_trabajo │   ├── reportes │   ├── sucursales │   ├── usuarios │   └── ventas_cotizaciones ├── __init__.py ├── manage.py ├── prerequirements_install.txt ├── procfile ├── proyecto_www │   ├── db.sqlite3 │   ├── __init__.py │   ├── __init__.pyc │   ├── readme.md │   ├── settings │   ├── urls.py │   ├── urls.pyc │   ├── wsgi.py │   └── wsgi.pyc ├── requirements.txt ├── static │   ├── css │   ├── datepicker │   ├── fonts │   ├── img │   ├── js │   ├── pdfs │   ├── plantilla │   ├── sass │   └── syntaxhighlighter ├── templates │   ├── base.html │   ├── base_list.html │   ├── datatableview │   └── includes 

wsgi.py

import os django.core.wsgi import get_wsgi_application dj_static import cling os.environ.setdefault("django_settings_module", "proyecto_www.settings.staging") application = cling(get_wsgi_application()) 

the parameters in settings are:

base_dir = path(__file__).ancestor(3) debug = true allowed_hosts = ['*'] staticfiles_dirs=(base_dir,'static') static_url = '/static/' wsgi_application = 'proyecto_www.wsgi.application' static_root = 'staticfiles' staticfiles_storage = 'whitenoise.django.gzipmanifeststaticfilesstorage' 

procfile content is

web: gunicorn proyecto_www.wsgi 

my main urls.py

from django.conf.urls import include, url django.contrib.staticfiles.urls import staticfiles_urlpatterns django.contrib import admin   urlpatterns=[             url(r'^admin/',include(admin.site.urls)),             url(r'^accounts/', include('django.contrib.auth.urls')),             url(r'^', include('apps.home.urls',namespace='home')),             url(r'^', include('apps.usuarios.urls',namespace='usuarios')),             url(r'^', include('apps.inventario.urls',namespace='inventario')),             url(r'^', include('apps.ventas_cotizaciones.urls',namespace='ventas_cotizaciones')),             url(r'^', include('apps.ordenes_trabajo.urls',namespace='ordenes_trabajo')),             url(r'^', include('apps.sucursales.urls', namespace='sucursales')),             url(r'^', include('apps.reportes.urls', namespace='reportes')),             ]  urlpatterns += patterns('',         (r'^static/(?p<path>.*)$', 'django.views.static.serve', {'document_root': settings.static_root}),     ) 

my heroku logs are:

2016-01-16t16:44:23.261629+00:00 app[web.1]: [2016-01-16 16:44:23 +0000] [3] [info] shutting down: master 2016-01-16t16:44:23.261703+00:00 app[web.1]: [2016-01-16 16:44:23 +0000] [3] [info] reason: worker failed boot. 2016-01-16t16:44:23.285624+00:00 heroku[router]: at=error code=h13 desc="connection closed without response" method=get path="/" host=crisefd-concesionario-www.herokuapp.com request_id=195b1b27-df0c-44e2-9e27-c59fd4de17ee fwd="181.52.225.237" dyno=web.1 connect=0ms service=27099ms status=503 bytes=0 2016-01-16t16:44:24.074843+00:00 heroku[web.1]: state changed crashed 2016-01-16t16:44:24.074843+00:00 heroku[web.1]: state changed crashed starting 2016-01-16t16:44:24.062495+00:00 heroku[web.1]: process exited status 3 2016-01-16t16:44:27.849620+00:00 heroku[web.1]: starting process command `gunicorn proyecto_www.wsgi` 2016-01-16t16:44:30.462707+00:00 app[web.1]: [2016-01-16 16:44:30 +0000] [3] [info] starting gunicorn 19.4.1 2016-01-16t16:44:30.503069+00:00 app[web.1]: [2016-01-16 16:44:30 +0000] [10] [info] booting worker pid: 10 2016-01-16t16:44:30.463623+00:00 app[web.1]: [2016-01-16 16:44:30 +0000] [3] [info] listening at: http://0.0.0.0:56568 (3) 2016-01-16t16:44:30.463891+00:00 app[web.1]: [2016-01-16 16:44:30 +0000] [3] [info] using worker: sync 2016-01-16t16:44:30.480976+00:00 app[web.1]: [2016-01-16 16:44:30 +0000] [9] [info] booting worker pid: 9 2016-01-16t16:44:31.712682+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2016-01-16t16:44:31.712691+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/whitenoise/django.py", line 20, in <module> 2016-01-16t16:44:31.712698+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2016-01-16t16:44:31.712706+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/whitenoise/django.py", line 20, in <module> 2016-01-16t16:44:31.714018+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi 2016-01-16t16:44:31.714025+00:00 app[web.1]:   file "/app/proyecto_www/wsgi.py", line 13, in <module> 2016-01-16t16:44:31.714032+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi 2016-01-16t16:44:31.714039+00:00 app[web.1]:   file "/app/proyecto_www/wsgi.py", line 13, in <module> 2016-01-16t16:44:31.712683+00:00 app[web.1]:     self.callable = self.load() 2016-01-16t16:44:31.712691+00:00 app[web.1]:     "'django_settings_module' environment variable must set " 2016-01-16t16:44:31.712699+00:00 app[web.1]:     self.callable = self.load() 2016-01-16t16:44:31.712706+00:00 app[web.1]:     "'django_settings_module' environment variable must set " 2016-01-16t16:44:31.714019+00:00 app[web.1]:     self.wsgi = self.app.wsgi() 2016-01-16t16:44:31.714026+00:00 app[web.1]:     whitenoise.django import djangowhitenoise 2016-01-16t16:44:31.714033+00:00 app[web.1]:     self.wsgi = self.app.wsgi() 2016-01-16t16:44:31.714040+00:00 app[web.1]:     whitenoise.django import djangowhitenoise 2016-01-16t16:44:31.712671+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [9] [error] exception in worker process: 2016-01-16t16:44:31.712684+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2016-01-16t16:44:31.712692+00:00 app[web.1]: improperlyconfigured: 'django_settings_module' environment variable must set before importing 'whitenoise.django' 2016-01-16t16:44:31.712700+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2016-01-16t16:44:31.712707+00:00 app[web.1]: improperlyconfigured: 'django_settings_module' environment variable must set before importing 'whitenoise.django' 2016-01-16t16:44:31.714020+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2016-01-16t16:44:31.714027+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/whitenoise/django.py", line 20, in <module> 2016-01-16t16:44:31.714034+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2016-01-16t16:44:31.714041+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/whitenoise/django.py", line 20, in <module> 2016-01-16t16:44:31.712676+00:00 app[web.1]: traceback (most recent call last): 2016-01-16t16:44:31.712684+00:00 app[web.1]:     return self.load_wsgiapp() 2016-01-16t16:44:31.712693+00:00 app[web.1]: traceback (most recent call last): 2016-01-16t16:44:31.712700+00:00 app[web.1]:     return self.load_wsgiapp() 2016-01-16t16:44:31.712803+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [9] [info] worker exiting (pid: 9) 2016-01-16t16:44:31.714020+00:00 app[web.1]:     self.callable = self.load() 2016-01-16t16:44:31.714027+00:00 app[web.1]:     "'django_settings_module' environment variable must set " 2016-01-16t16:44:31.714034+00:00 app[web.1]:     self.callable = self.load() 2016-01-16t16:44:31.714048+00:00 app[web.1]:     "'django_settings_module' environment variable must set " 2016-01-16t16:44:31.712678+00:00 app[web.1]:     worker.init_process() 2016-01-16t16:44:31.712686+00:00 app[web.1]:     return util.import_app(self.app_uri) 2016-01-16t16:44:31.712695+00:00 app[web.1]:     worker.init_process() 2016-01-16t16:44:31.712702+00:00 app[web.1]:     return util.import_app(self.app_uri) 2016-01-16t16:44:31.714014+00:00 app[web.1]: traceback (most recent call last): 2016-01-16t16:44:31.714022+00:00 app[web.1]:     return self.load_wsgiapp() 2016-01-16t16:44:31.714029+00:00 app[web.1]: traceback (most recent call last): 2016-01-16t16:44:31.714036+00:00 app[web.1]:     return self.load_wsgiapp() 2016-01-16t16:44:31.714203+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [10] [info] worker exiting (pid: 10) 2016-01-16t16:44:31.712677+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker 2016-01-16t16:44:31.712685+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2016-01-16t16:44:31.712694+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker 2016-01-16t16:44:31.712701+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2016-01-16t16:44:31.714012+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [10] [error] exception in worker process: 2016-01-16t16:44:31.714021+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2016-01-16t16:44:31.714028+00:00 app[web.1]: improperlyconfigured: 'django_settings_module' environment variable must set before importing 'whitenoise.django' 2016-01-16t16:44:31.714035+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2016-01-16t16:44:31.714049+00:00 app[web.1]: improperlyconfigured: 'django_settings_module' environment variable must set before importing 'whitenoise.django' 2016-01-16t16:44:31.712679+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process 2016-01-16t16:44:31.712687+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app 2016-01-16t16:44:31.712696+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process 2016-01-16t16:44:31.712703+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app 2016-01-16t16:44:31.714015+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker 2016-01-16t16:44:31.714023+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2016-01-16t16:44:31.714030+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker 2016-01-16t16:44:31.714037+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2016-01-16t16:44:31.751764+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [3] [info] shutting down: master 2016-01-16t16:44:31.712680+00:00 app[web.1]:     self.load_wsgi() 2016-01-16t16:44:31.712688+00:00 app[web.1]:     __import__(module) 2016-01-16t16:44:31.712696+00:00 app[web.1]:     self.load_wsgi() 2016-01-16t16:44:31.712703+00:00 app[web.1]:     __import__(module) 2016-01-16t16:44:31.714016+00:00 app[web.1]:     worker.init_process() 2016-01-16t16:44:31.714023+00:00 app[web.1]:     return util.import_app(self.app_uri) 2016-01-16t16:44:31.714030+00:00 app[web.1]:     worker.init_process() 2016-01-16t16:44:31.714037+00:00 app[web.1]:     return util.import_app(self.app_uri) 2016-01-16t16:44:31.751871+00:00 app[web.1]: [2016-01-16 16:44:31 +0000] [3] [info] reason: worker failed boot. 2016-01-16t16:44:31.712681+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi 2016-01-16t16:44:31.712689+00:00 app[web.1]:   file "/app/proyecto_www/wsgi.py", line 13, in <module> 2016-01-16t16:44:31.712697+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi 2016-01-16t16:44:31.712704+00:00 app[web.1]:   file "/app/proyecto_www/wsgi.py", line 13, in <module> 2016-01-16t16:44:31.714017+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process 2016-01-16t16:44:31.714024+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app 2016-01-16t16:44:31.714031+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process 2016-01-16t16:44:31.714038+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app 2016-01-16t16:44:31.712681+00:00 app[web.1]:     self.wsgi = self.app.wsgi() 2016-01-16t16:44:31.712690+00:00 app[web.1]:     whitenoise.django import djangowhitenoise 2016-01-16t16:44:31.712698+00:00 app[web.1]:     self.wsgi = self.app.wsgi() 2016-01-16t16:44:31.712705+00:00 app[web.1]:     whitenoise.django import djangowhitenoise 2016-01-16t16:44:31.714018+00:00 app[web.1]:     self.load_wsgi() 2016-01-16t16:44:31.714025+00:00 app[web.1]:     __import__(module) 2016-01-16t16:44:31.714032+00:00 app[web.1]:     self.load_wsgi() 2016-01-16t16:44:31.714039+00:00 app[web.1]:     __import__(module) 2016-01-16t16:44:32.508739+00:00 heroku[web.1]: state changed crashed 2016-01-16t16:44:32.502339+00:00 heroku[web.1]: process exited status 3 2016-01-16t16:44:31.496313+00:00 heroku[web.1]: state changed starting 

i don't think haven't posted actual wsgi.py file. exception getting whitenoise, file posted uses dj_static.

to avoid error need make sure line:

os.environ.setdefault("django_settings_module", "proyecto_www.settings.staging") 

comes before import whitenoise.django.

this due bug in django fixed in later versions.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -