Deploying Python-django project on Heroku -
i'm trying deploy small test app on heroku, gets pushed heroku master no errors on running app gives application error. checked heroku logs , got following error :
**2015-07-11t03:56:03.004853+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11t03:56:03.048862+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [3] [info] reason: worker failed boot. 2015-07-11t03:56:03.004854+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11t03:56:03.004855+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11t03:56:03.004857+00:00 app[web.1]: self.callable = self.load() 2015-07-11t03:56:03.004858+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11t03:56:03.004859+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11t03:56:03.004860+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11t03:56:03.004861+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11t03:56:03.004863+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11t03:56:03.004865+00:00 app[web.1]: file "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11t03:56:03.004864+00:00 app[web.1]: __import__(module) 2015-07-11t03:56:03.004866+00:00 app[web.1]: dj_static import cling 2015-07-11t03:56:03.004868+00:00 app[web.1]: importerror: no module named dj_static 2015-07-11t03:56:03.005003+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [10] [info] worker exiting (pid: 10) 2015-07-11t03:56:03.048672+00:00 app[web.1]: [2015-07-11 03:56:03 +0000] [3] [info] shutting down: master 2015-07-11t03:56:03.955134+00:00 heroku[web.1]: state changed crashed 2015-07-11t03:56:03.955995+00:00 heroku[web.1]: state changed crashed starting 2015-07-11t03:56:03.934809+00:00 heroku[web.1]: process exited status 3 2015-07-11t03:56:07.906911+00:00 heroku[web.1]: starting process command `gunicorn semicoloninc.wsgi:application` 2015-07-11t03:56:09.283990+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [info] starting gunicorn 19.3.0 2015-07-11t03:56:09.320937+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [info] booting worker pid: 10 2015-07-11t03:56:09.284694+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [info] listening at: http://0.0.0.0:57450 (3) 2015-07-11t03:56:09.284785+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [info] using worker: sync 2015-07-11t03:56:09.296813+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [info] booting worker pid: 9 2015-07-11t03:56:09.545553+00:00 heroku[web.1]: state changed starting 2015-07-11t03:56:09.937863+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [error] exception in worker process: 2015-07-11t03:56:09.937869+00:00 app[web.1]: traceback (most recent call last): 2015-07-11t03:56:09.937872+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11t03:56:09.937873+00:00 app[web.1]: worker.init_process() 2015-07-11t03:56:09.937875+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11t03:56:09.937878+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11t03:56:09.937876+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11t03:56:09.937879+00:00 app[web.1]: self.callable = self.load() 2015-07-11t03:56:09.937882+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11t03:56:09.937881+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11t03:56:09.937884+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11t03:56:09.937885+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11t03:56:09.937887+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11t03:56:09.937888+00:00 app[web.1]: __import__(module) 2015-07-11t03:56:09.937890+00:00 app[web.1]: file "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11t03:56:09.937891+00:00 app[web.1]: dj_static import cling 2015-07-11t03:56:09.937893+00:00 app[web.1]: importerror: no module named dj_static 2015-07-11t03:56:09.937894+00:00 app[web.1]: traceback (most recent call last): 2015-07-11t03:56:09.937895+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11t03:56:09.937896+00:00 app[web.1]: worker.init_process() 2015-07-11t03:56:09.937898+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11t03:56:09.937899+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11t03:56:09.937900+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11t03:56:09.937901+00:00 app[web.1]: self.callable = self.load() 2015-07-11t03:56:09.937903+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11t03:56:09.937904+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11t03:56:09.937905+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11t03:56:09.937906+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11t03:56:09.937908+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11t03:56:09.937910+00:00 app[web.1]: file "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11t03:56:09.937909+00:00 app[web.1]: __import__(module) 2015-07-11t03:56:09.937912+00:00 app[web.1]: dj_static import cling 2015-07-11t03:56:09.937913+00:00 app[web.1]: importerror: no module named dj_static 2015-07-11t03:56:09.938031+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [9] [info] worker exiting (pid: 9) 2015-07-11t03:56:09.965385+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [error] exception in worker process: 2015-07-11t03:56:09.965391+00:00 app[web.1]: traceback (most recent call last): 2015-07-11t03:56:09.965394+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11t03:56:09.965396+00:00 app[web.1]: worker.init_process() 2015-07-11t03:56:09.965397+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11t03:56:09.965398+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11t03:56:09.965400+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11t03:56:09.965402+00:00 app[web.1]: self.callable = self.load() 2015-07-11t03:56:09.965404+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11t03:56:09.965405+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11t03:56:09.965408+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11t03:56:09.965410+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11t03:56:09.965406+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11t03:56:09.965411+00:00 app[web.1]: __import__(module) 2015-07-11t03:56:09.965414+00:00 app[web.1]: dj_static import cling 2015-07-11t03:56:09.965415+00:00 app[web.1]: importerror: no module named dj_static 2015-07-11t03:56:09.965412+00:00 app[web.1]: file "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11t03:56:09.965416+00:00 app[web.1]: traceback (most recent call last): 2015-07-11t03:56:09.965418+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker 2015-07-11t03:56:09.965419+00:00 app[web.1]: worker.init_process() 2015-07-11t03:56:09.965420+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process 2015-07-11t03:56:09.965422+00:00 app[web.1]: self.wsgi = self.app.wsgi() 2015-07-11t03:56:09.965423+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2015-07-11t03:56:09.965424+00:00 app[web.1]: self.callable = self.load() 2015-07-11t03:56:09.965425+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load 2015-07-11t03:56:09.965427+00:00 app[web.1]: return self.load_wsgiapp() 2015-07-11t03:56:09.965428+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp 2015-07-11t03:56:09.965429+00:00 app[web.1]: return util.import_app(self.app_uri) 2015-07-11t03:56:09.965430+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app 2015-07-11t03:56:09.965434+00:00 app[web.1]: __import__(module) 2015-07-11t03:56:09.965435+00:00 app[web.1]: file "/app/semicoloninc/wsgi.py", line 13, in <module> 2015-07-11t03:56:09.965436+00:00 app[web.1]: dj_static import cling 2015-07-11t03:56:09.965438+00:00 app[web.1]: importerror: no module named dj_static 2015-07-11t03:56:09.978589+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [info] shutting down: master 2015-07-11t03:56:09.965533+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [10] [info] worker exiting (pid: 10) 2015-07-11t03:56:09.978679+00:00 app[web.1]: [2015-07-11 03:56:09 +0000] [3] [info] reason: worker failed boot. 2015-07-11t03:56:10.732554+00:00 heroku[web.1]: state changed crashed 2015-07-11t03:56:10.716153+00:00 heroku[web.1]: process exited status 3 2015-07-11t03:56:15.464379+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/" host=fuddi.herokuapp.com request_id=aa45beef-2257-42b4-a4f7-60decf81282d fwd="120.59.67.176" dyno=web.1 connect=5013ms service= status=503 bytes= 2015-07-11t03:56:17.331663+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/favicon.ico" host=fuddi.herokuapp.com request_id=bbd9b863-14b7-4fce-b02e-d13b1c9e1b4c fwd="120.59.67.176" dyno= connect= service= status=503 bytes= 2015-07-11t03:56:18.072135+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/favicon.ico" host=fuddi.herokuapp.com request_id=60f31c6e-55af-440b-8842-f6b7c4727919 fwd="120.59.67.176" dyno= connect= service= status=503 bytes=**
i know there problem import , gunicorn , wsgi imports. please me out.
my procfile is:
web: gunicorn semicoloninc.wsgi:application
wsgi.py
import os django.core.wsgi import get_wsgi_application dj_static import cling os.environ.setdefault("django_settings_module", "semicoloninc.settings")
settings.py
secure_proxy_ssl_header = ('http_x_forwarded_proto', 'https') # allow host headers allowed_hosts = ['*'] # build paths inside project this: os.path.join(base_dir, ...) import os base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) settings_dir = os.path.dirname(__file__) project_path = os.path.join(settings_dir, os.pardir) project_path = os.path.abspath(project_path) # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # security warning: keep secret key used in production secret! secret_key = 'fhi2%%r#ck5kfl-42#t$bil+hxtlpp7wj42lpd8zv0i#%^2iiz' # security warning: don't run debug turned on in production! debug = true allowed_hosts = [] template_path = os.path.join(project_path, 'templates') static_path = os.path.join(project_path, 'static') # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'contactus', ) middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'django.middleware.security.securitymiddleware', ) root_urlconf = 'semicoloninc.urls' templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [template_path], '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 = 'semicoloninc.wsgi.application' # database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } # internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ static_url = '/static/' staticfiles_dirs = ( static_path, ) application = cling(get_wsgi_application())
seems should clear logs ... importerror: no module named dj_static
, don't want read official docs :d
https://devcenter.heroku.com/articles/getting-started-with-django
pip install django-toolbelt
installing collected packages: django, psycopg2, gunicorn, dj-database-url, dj-static, static
successfully installed django psycopg2 gunicorn dj-database-url dj-static static cleaning up...
Comments
Post a Comment