我被困在通过 Procfile 在 Heroku 上运行 Django 1.4 应用程序。我已阅读所有相关帖子,并且我确定这不是区分大小写的相关问题,因为我正确命名为 Procfile。这是我的项目结构。注意 Procfile 与 manage.py 处于同一级别
.
├── README.md
├── docs
├── project
│   ├── Procfile
│   ├── client
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── models.py
│   │   ├── templates
│   │   │   └── welcome.html
│   │   ├── tests.py
│   │   ├── views.py
│   │   └── views.pyc
│   ├── manage.py
│   └── wings
│       ├── __init__.py
│       ├── __init__.pyc
│       ├── settings.py
│       ├── settings.pyc
│       ├── urls.py
│       ├── urls.pyc
│       ├── wsgi.py
│       └── wsgi.pyc
├── requirements.txt
├── static
│   ├── css
│   ├── images
│   └── js
├── tests
└── uploads
这是Procfile:
web:python manage.py runserver
这里是在本地运行它的工头的输出(工作正常)
10:29:28 web.1     | started with pid 595
我正在推动heroku:
Procfile declares types -> (none)
尝试通过 heroku toolbelt 对其进行缩放:
$ heroku ps:scale web=1 --app myapp
Scaling web processes... failed
!    Record not found.
我总是通过网络创建我的应用程序,所以我总是需要放置 --app 参数。可能与我如何创建我的应用程序相关的任何问题?
我还尝试了以下方法:
MacBook-Pro-de-Sergio:myapp sergio$ heroku run python project/manage.py runserver
Running `python project/manage.py runserver` attached to terminal... up, run.1
Validating models...
0 errors found
Django version 1.4, using settings 'wings.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
这是我的应用程序的日志:
2012-07-18T09:18:51+00:00 heroku[run.1]: Starting process with command `python       project/manage.py runserver`
2012-07-18T09:18:51+00:00 heroku[run.1]: State changed from starting to up
2012-07-18T09:19:16+00:00 heroku[router]: Error H14 (No web processes running) -> GET peoplewings.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-18T09:19:16+00:00 heroku[router]: Error H14 (No web processes running) -> GET peoplewings.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
回答
正如 Neil 指出的那样,Procfile 应该位于 git repo 的根目录中。我还必须在 Procfile 上设置主机和端口,因为默认 Web 服务器指向 127.0.0.1:8000,这在 heroku 上不起作用
web: python project/manage.py runserver 0.0.0.0:$PORT