Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Heroku的Procfile的正确目录_Python_Django_Heroku - Fatal编程技术网

Python Heroku的Procfile的正确目录

Python Heroku的Procfile的正确目录,python,django,heroku,Python,Django,Heroku,我正在尝试将一个基本的Python博客/网站迁移到Heroku,以便将其部署到internet上。我已经完成了部分过程,但在获取正确的Procfile时遇到了问题。我正在按照所示的说明进行操作 “Mysite”是我的站点的顶级目录。我已经按照说明书把虚拟电视放进去了 我不确定Procfile需要放在哪里-下面是我遇到的错误: C:\Users\andre\mysite>virtualenv venv Using base prefix 'c:\\users\\andre\\appdata\

我正在尝试将一个基本的Python博客/网站迁移到Heroku,以便将其部署到internet上。我已经完成了部分过程,但在获取正确的Procfile时遇到了问题。我正在按照所示的说明进行操作

“Mysite”是我的站点的顶级目录。我已经按照说明书把虚拟电视放进去了

我不确定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
扩展名。发件人:

Procfile是名为
Procfile
的文件。它应该准确地命名为
Procfile
,而不是其他名称。例如,
Procfile.txt
无效。该文件应该是一个简单的文本文件

文件必须放在应用程序的根目录中。如果放在子目录中,它将不起作用


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

谢谢Chris。我尝试在目录中向上移动Procfile,但没有帮助-导致了相同的错误。我已经做了修改,使我的目录显示得更深入一点,这可能会有更多的启示。基本上,“andre”文件夹是我电脑的通用目录。另外,我从Procfile中删除了“.txt”,但这也没有帮助。@AME,看起来您的
Procfile
引用了一个不存在的文件:
mysite.wsgi
。你有WSGI文件吗?没错,Chris,我假设配置/定位WSGI文件会在稍后的过程中出现,尽管我可能会弄错。你认为这就是问题所在吗?我假设问题是Procfile一开始就没有被定位和读取。我确实在下面的目录(@andre/mysite/mysite/WSGI.py)中有一个WSGI.py文件。应该把东西搬到那里去吗?再次感谢。@AME,我认为WSGI文件不需要在根目录中,而且
Procfile
当然不应该被移动。尝试编辑
Procfile
并将
mysite.wsgi
替换为
path/to/your/real/wsgi.py
。明白了-不幸的是仍然存在同样的问题。还有一个想法-我的requirements.txt文件可能不正确吗?它唯一的内容是“wheel==0.24.0”-这看起来有错吗?根据本文中列出的建议,我还尝试将Procfile文本切换为“web:python manage.py runserver 0.0.0:$PORT”,但也没有效果: