简体   繁体   中英

No web processes running Django in heroku

I was trying to deploy my application in heroku, but when i finally try to run my application in heroku I het in the browser this:

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.

When i see my logs I get the next:

2013-08-31T19:53:30.672416+00:00 heroku[api]: Enable Logplex by user@example.com
2013-08-31T19:53:30.700218+00:00 heroku[api]: Release v2 created by user@example.com
2013-08-31T19:58:41+00:00 heroku[slug-compiler]: Slug compilation started
2013-08-31T20:04:12.967456+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:04:13.161016+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:13:46+00:00 heroku[slug-compiler]: Slug compilation timed out: 904.285527871 seconds.
2013-08-31T20:22:52.646361+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:22:55.043424+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:26:14+00:00 heroku[slug-compiler]: Slug compilation started
2013-08-31T20:38:41+00:00 heroku[slug-compiler]: Slug compilation started
2013-08-31T20:41:22+00:00 heroku[slug-compiler]: Slug compilation timed out: 908.241350492 seconds.
2013-08-31T20:49:24.238496+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:49:24.644910+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:53:47+00:00 heroku[slug-compiler]: Slug compilation timed out: 907.148099965 seconds.
2013-08-31T20:56:59+00:00 heroku[slug-compiler]: Slug compilation started
2013-08-31T20:58:50.641624+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_AQUA resource by user@example.com
2013-08-31T20:58:50.658435+00:00 heroku[api]: Release v3 created by user@example.com
2013-08-31T20:58:50.742803+00:00 heroku[api]: Add DATABASE_URL config by user@example.com
2013-08-31T20:58:50.782484+00:00 heroku[api]: Release v4 created by user@example.com
2013-08-31T20:58:50.840509+00:00 heroku[api]: Deploy 78dba6c by user@example.com
2013-08-31T20:58:50.852187+00:00 heroku[api]: Release v5 created by user@example.com
2013-08-31T20:58:54+00:00 heroku[slug-compiler]: Slug compilation finished
2013-08-31T21:00:25.085053+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:00:24.751074+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:01:03.272614+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:01:03.815558+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:02:10.279054+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:03:25.381362+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:03:25.709121+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
2013-08-31T21:03:45.285962+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=
christian@christian-R480-R431-R481:~/Documentos/heroku/portafolio/venv$ 

Benjamin Manns' solution worked for me, though I needed one additional step as well.

According to this , after the Procfile solution has been pushed, run the following:

heroku ps:scale web=1

website should load correctly now.

for more help pushing to a heroku git repo, see this

添加proc文件并运行以下命令

$ heroku ps:scale web=1

Have you gone through the Heroku guide for setting up a Django application ? What does your Procfile look like?

Your project should have a file named Procfile that should have contents similar to

web: gunicorn hellodjango.wsgi

Your Procfile must look like this (for python):

web: python myApp.py runserver 0.0.0.0:$PORT

If you are in python/django

heroku logs --tail

if you are unable to find the bug and fix then try doing,

First Run to see whether its working in herokus local

heroku local web

Mine was to specify the path of django wsgi.py file in Procfile

see their example https://github.com/heroku/python-getting-started

The Procfile will look similar to this

web: gunicorn projectname.wsgi --log-file -

You may have to install gunicorn if not installed and add it to requirements.txt

Then Git add and commit, after that push to heroku

git push heroku master

Then scale your app

heroku ps:scale web=1

I did the following steps to make it work.

1) I had to move my Procfile to the outermost folder.

2) Then I had to change my Procfile to

web: gunicorn projectname.projectname.wsgi

3) Also in my wsgi file I had to change my settings path to

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'projectname.projectname.settings')

4) In my settings.py file I had to change my ROOT_URLCONF

ROOT_URLCONF = 'projectname.projectname.urls'

5) In urls.py I had to change my path to

from projectname.applicationname import urls as app_urls

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(app_urls)),
]

6) Finally I did

git push heroku master
heroku ps:scale web=1

After making all these changes heroku worked like a charm. But it doesn't work locally on windows because I read somewhere windows doesn't have gunicorn.

When I tried python projectname/manage.py runserver locally it said

ModuleNotFoundError: No module named 'projectname.projectname'

So for running it locally I've to revert all the steps above :P

in my case it was dynos configuration error,i meant to say that if u re not premium member see whether dynos available for your app from heroku dashbord. this u can check by clicking on metrics,if you don't have one estimate it. run command $ heroku ps:scale web=1 push your code in master.

I was getting application error I checked heroku logs --tail , in desc="No web processes running" Mostly this occur due to Procfile, so inside Procfile I forgot to give space after "web:"

web: gunicorn hellodjango.wsgi --log-file - 

so check your Procfile{this file is to be created in root folder just inside project folder}

Though it is already said but please do a check if the Procfile , runtime.txt and requirements.txt are in the outermost folder. (These files will be placed in the location of manage.py )

My case was a little different. I had settled up everything and deployed my app on Heroku. I have deployed 3 4 python apps on Heroku previously. had Procfile and requirements.txt in root folder.

This time, I tried almost the whole every guide and StackOverflow answers but found nothing. Then just added a space after web: and gunicorn and it worked perfectly.

previously I was using web:gunicorn wsgi:app

I just changed that to web: gunicorn wsgi:app and It worked like a charm

在此处输入图像描述

Make sure your dynos is running otherwise you will get this above error also. and then you have to manually start dynos on heroku, while heroku automatically start that for you but some time you have to do run manually on heroku. Click on a Configure dynos button ==> toggle the dynos button and your dynos will start.

Check your dyno's configuration in the Heroku dashboard. It might be the wrong app name before the wsgi module. I had an old project's app name instead of the one I tried to use:

web: gunicorn old_project_app.wsgi

Correct your Procfile and push it to Heroku. You might need to delete and recreate the file. It should then be like this in the dyno config:

web: gunicorn new_project_app.wsgi

Make sure the spelling of the Procfile. Its supposed to be "Procfile" and not "procfile"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM