gpt4 book ai didi

python - Heroku 的 Procfile 的正确目录

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:27 25 4
gpt4 key购买 nike

我正在尝试将基本的 Python 博客/网站迁移到 Heroku 以将其部署到互联网。我部分完成了这个过程,但在正确设置 Procfile 时遇到了问题。我正在按照显示的说明进行操作 here for Heroku .

“我的站点”是我站点的顶级目录。根据说明,我已将 virtualenv 放入其中。

我不确定 Procfile 需要去哪里 - 这是我遇到的错误:

C:\Users\andre\mysite>virtualenv venv
Using base prefix 'c:\\users\\andre\\appdata\\local\\programs\\python\\python35-32'
New python executable in venv\Scripts\python.exe
Installing setuptools, pip, wheel...done.

C:\Users\andre\mysite>venv\Scripts\activate
(venv) C:\Users\andre\mysite>pip freeze > requirements.txt
You are using pip version 7.1.2, however version 8.1.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(venv) C:\Users\andre\mysite>pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): wheel==0.24.0 in c:\users\andre\mysite\venv\lib\site-packages (from -r requirements.txt (line 1))
You are using pip version 7.1.2, however version 8.1.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(venv) C:\Users\andre\mysite>heroku local web
ERROR: open Procfile: The system cannot find the file specified.

我曾尝试将 Procfile 放置在几个不同的地方,但没有成功消除错误。

我正在使用的 Procfile 具有以下内容:

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

文件目录如下:

andre/
-Documents/
-Desktop/
-AppData/
-Local/
-heroku/
-mysite/
-blog/
-mysite/
-venv/
-db.sqlite3
-manage.py
-Procfile
-requirements.txt

关于我在这里可能做错了什么有什么建议吗?谢谢。

最佳答案

将其向上移动一个目录到存储库的根目录,并删除 .txt 扩展名。来自 the documentation :

A Procfile is a file named Procfile. It should be named Procfile exactly, and not anything else. For example, Procfile.txt is not valid. The file should be a simple text file.

The file must be placed in the root directory of your application. It will not function if placed in a subdirectory.

本文档适用于 Heroku 支持的所有语言。当文档说“应用程序的根目录”时,它指的是根目录,而不是 Django 应用程序。

关于python - Heroku 的 Procfile 的正确目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35830067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com