2016-03-06 87 views
4

我试图将一个基本的Python博客/网站迁移到Heroku,将其部署到互联网。我部分通过这个过程,并且无法正确获取Procfile。我遵循here for Heroku的说明。Heroku Procfile的正确目录

“Mysite”是我网站的顶级目录。我已经把virtualenv放在它里面,按照instuctions。

我不知道在哪里的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 

任何建议我可能是错在这里做什么?谢谢。

回答

3

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

Procfile是一个名为Procfile的文件。它应该被命名为Procfile,而不是别的。例如,Procfile.txt无效。该文件应该是一个简单的文本文件。

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

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

+0

谢谢克里斯。我试图在目录中移动Procfile,但这没有帮助 - 导致同样的错误。我已经修改过,以显示我的目录更深入一点,可能会提供更多的信息。基本上,“andre”文件夹是我的电脑的一个通用目录。另外,我已经触及Procfile的“.txt”,但这也没有帮助。 – AME

+0

@AME,看起来你的'Procfile'引用了一个不存在的文件:'mysite.wsgi'。你有WSGI文件吗? – Chris

+0

这是正确的,克里斯,我假设配置/定位WSGI文件将在后来的过程中,虽然我可能会误会。你认为这是问题吗?我认为问题在于Procfile并没有被放置在第一位。我在目录(@ andre/mysite/mysite/wsgi.py)中有一个WSGI.py文件。应该把东西搬到那里?再次感谢。 – AME