Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
787 views
in Technique[技术] by (71.8m points)

heroku - Django Deployment - No web processes

I created an application using Django 3.1.5 and for some reason, it does not deploy correctly. I will share what I did and have it.

I have set up my Procfile and I have my requirements.txt, I did the deployment as I told on the website, but I am still getting an error.

computer setting image and Procfile

On my settings.py I have this:

# on the top of the file
import django_heroku

# on the bottom of the file
STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_DIRS = [
    os.path.join(BASE_DIR, 'todo/static')
]

LOGIN_URL = '/login'

# Activate Django-Heroku.
django_heroku.settings(locals())

Procfile

web: gunicorn todowoo.wsgi

After I finish the deployment I get this error

Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. heroku logs --tail for details

Here are the details:

2021-01-27T03:16:07.704192+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=babd8359-3dfe-4df9-8ce6-5243de91b159 fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:07.912002+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=4114d73f-f15f-4d35-9c1b-e25225a36bde fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:10.630599+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=9426a4a1-061f-41b6-a9a0-46190b752b60 fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:10.760576+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=cb4c8412-eaa2-482a-9daa-e5126f2a89e3 fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:11.398016+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=8f025699-e7b8-4ca8-9795-36ad7754ef9f fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:11.548669+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=d1c4ed4e-bbf6-43ff-88d0-2788f268fbe3 fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:18:44.000000+00:00 app[api]: Build started by user [email protected]
2021-01-27T03:19:12.176886+00:00 app[api]: Release v6 created by user [email protected]
2021-01-27T03:19:12.176886+00:00 app[api]: Deploy 6caa0271 by user [email protected]
2021-01-27T03:19:22.000000+00:00 app[api]: Build succeeded

I tried to run heroku ps:scale web=1 and I got this:

Scaling dynos... !
 !    Couldn't find that process type (web).

Any idea how to solve this? Thank you.

question from:https://stackoverflow.com/questions/65912695/django-deployment-no-web-processes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have encountered a similar situation very recently. I followed these commands to successfully deploy django app into heroku

  • First make sure you have requirements.txt and Procfile

  • In Procfile, the contents were like this

  • web: python manage.py runserver 0.0.0.0:$PORT

  • And run python manage.py collectstatic just to make sure no errors from collectstatic

  • Then these commands in cmd

  • heroku login

  • Then login from browser

  • git init

  • heroku git:remote -a app_name

  • git add .

  • git commit -am "first commit"

  • git push heroku main

  • heroku run python manage.py migrate

  • heroku open


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...