Heroku Django部署成功,但是应用程序URL显示“应用程序错误”

时间:2019-03-06 05:40:22

标签: django heroku

我能够部署在Heroku上创建和部署Django应用。我的应用程序在本地运行。但是当我运行heroku open时,我得到了默认错误消息

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

wsgi.py

import os

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "allistic_server.settings")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

Procfile

web:gunicorn server.wsgi --log-file

requirements.txt

Django==2.0.8
djangorestframework==3.9.1
gunicorn==19.7.2
whitenoise==3.6

heroku日志--tail

2019-03-05T19:14:22.539357+00:00 heroku[run.5495]: Awaiting client
2019-03-05T19:14:22.621479+00:00 heroku[run.5495]: Starting process with command `python3 manage.py migrate`
2019-03-05T19:14:30.032541+00:00 heroku[run.5495]: State changed from up to complete
2019-03-05T19:14:30.012744+00:00 heroku[run.5495]: Process exited with status 0
2019-03-05T19:14:32.734812+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=allistic-server.herokuapp.com request_id=8ad9d0a4-c449-4d43-8c0d-dbca27057c15 fwd="1.186.161.14" dyno= connect= service= status=503 bytes= protocol=https
2019-03-06T03:48:06.561682+00:00 app[api]: Starting process with command `bash` by user nedheesh.hasija@gmail.com
2019-03-06T03:48:12.189344+00:00 heroku[run.5469]: Awaiting client
2019-03-06T03:48:12.352258+00:00 heroku[run.5469]: State changed from starting to up
2019-03-06T03:48:42.200755+00:00 heroku[run.5469]: State changed from up to complete
2019-03-06T03:48:42.208643+00:00 heroku[run.5469]: Error R13 (Attach error) -> Failed to attach to process
2019-03-06T03:48:42.208643+00:00 heroku[run.5469]: Process exited with status 128
2019-03-06T03:49:06.415742+00:00 app[api]: Starting process with command `python3 manage.py makemigrations server` by user nedheesh.hasija@gmail.com
2019-03-06T03:49:11.116008+00:00 heroku[run.8566]: State changed from starting to up
2019-03-06T03:49:10.945200+00:00 heroku[run.8566]: Awaiting client
2019-03-06T03:49:10.978874+00:00 heroku[run.8566]: Starting process with command `python3 manage.py makemigrations server`
2019-03-06T03:49:15.768377+00:00 heroku[run.8566]: State changed from up to complete
2019-03-06T03:49:15.755742+00:00 heroku[run.8566]: Process exited with status 0
2019-03-06T03:49:27.418851+00:00 app[api]: Starting process with command `python3 manage.py migrate` by user nedheesh.hasija@gmail.com
2019-03-06T03:49:32.142089+00:00 heroku[run.4691]: Awaiting client
2019-03-06T03:49:32.162472+00:00 heroku[run.4691]: Starting process with command `python3 manage.py migrate`
2019-03-06T03:49:32.288884+00:00 heroku[run.4691]: State changed from starting to up
2019-03-06T03:49:37.323528+00:00 heroku[run.4691]: State changed from up to complete
2019-03-06T03:49:37.313173+00:00 heroku[run.4691]: Process exited with status 0
2019-03-06T03:50:31.399736+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=allistic-server.herokuapp.com request_id=626bda41-2cdc-44ce-95f1-f06440bb84a8 fwd="1.186.161.14" dyno= connect= service= status=503 bytes= protocol=https
2019-03-06T03:50:31.727399+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=allistic-server.herokuapp.com request_id=c1ea577e-a38f-487b-bf0a-557d1494155f fwd="1.186.161.14" dyno= connect= service= status=503 bytes= protocol=https
2019-03-06T03:50:31.732747+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=allistic-server.herokuapp.com request_id=00a45ba6-bf19-4a9f-8ce2-f41e585ae165 fwd="1.186.161.14" dyno= connect= service= status=503 bytes= protocol=https

1 个答案:

答案 0 :(得分:0)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "allistic_server.settings")

我可以看到您的项目被称为allistic_server,但是在procfile中,您提到了“ server.wsgi”,这不是有效路径。改变这个

web:gunicorn server.wsgi --log-file

web:gunicorn allistic_server.wsgi --log-file