首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Django部署-无web进程

Django部署-无web进程
EN

Stack Overflow用户
提问于 2021-01-27 11:56:17
回答 1查看 58关注 0票数 0

我使用Django 3.1.5创建了一个应用程序,但由于某些原因,它不能正确部署。我会分享我的所作所为,并拥有它。

我已经设置了我的Procfile和我的requirements.txt,我按照我在网站上所说的做了部署,但我仍然收到一个错误。

computer setting image and Procfile

在我的settings.py上,我有这个:

代码语言:javascript
运行
复制
# 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

在我完成部署之后,我得到这个错误

应用程序错误应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请查看您的日志以了解详细信息。heroku日志--tail获取详细信息

以下是详细信息:

代码语言:javascript
运行
复制
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 lenilunderman@gmail.com
2021-01-27T03:19:12.176886+00:00 app[api]: Release v6 created by user lenilunderman@gmail.com
2021-01-27T03:19:12.176886+00:00 app[api]: Deploy 6caa0271 by user lenilunderman@gmail.com
2021-01-27T03:19:22.000000+00:00 app[api]: Build succeeded

我尝试运行heroku ps:scale web=1,得到的结果是:

代码语言:javascript
运行
复制
Scaling dynos... !
 !    Couldn't find that process type (web).

你知道怎么解决这个问题吗?谢谢。

EN

回答 1

Stack Overflow用户

发布于 2021-01-27 12:08:26

我最近也遇到过类似的情况。我遵循以下命令成功地将django应用程序部署到heroku中

首先,确保您拥有requirements.txtProcfile

  • Procfile中,内容类似于

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

为了确保没有来自collectstatic的错误,运行

  • 并运行python manage.py collectstatic

cmd中使用

  • ,然后执行以下命令

  • heroku登录

然后,

  • 从browser

登录

  • git init

  • heroku git:remote -a app_name

  • git add .

  • git commit -am "first commit"

  • git推送heroku main

  • heroku run python manage.py migrate

  • heroku打开
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65912695

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档