【问题标题】:Django-twoscoops-project (skeleton) on Heroku via Gunicorn. How to set Procfile?通过 Gunicorn 在 Heroku 上的 Django-twoscoops-project(骨架)。如何设置Procfile?
【发布时间】:2013-12-22 09:59:47
【问题描述】:

我正在尝试通过 Gunicorn 在 Heroku 上运行 twoscoopsofdjango skeleton

这是项目根目录的文件树(为了便于阅读,省略了一些不重要的文件夹):

.
├── LICENSE.txt
├── my_project
│   ├── manage.py
│   ├── my_project
│   │   ├── __init__.py
│   │   ├── settings
│   │   │   ├── base.py
│   │   │   ├── __init__.py
│   │   │   ├── local.py
│   │   │   ├── production.py
│   │   │   └── test.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   └── templates
│       ├── 404.html
│       ├── 500.html
│       └── base.html
├── README.rst
├── requirements
│   ├── base.txt
│   ├── local.txt
│   ├── production.txt
│   └── test.txt
└── requirements.txt

现在我需要像从以下缩短树中的 my_project 文件夹中运行 Gunicorn 一样运行它:

.
├── LICENSE.txt
├── my_project
│   ├── manage.py

但是,我需要从 项目根目录 发出命令,因为 Heroku Procfile 仅在项目根目录的最低级别被拾取。

所以在本地的 shell 中,我只需 cd my_project 然后运行 ​​gunicorn my_project.wsgi --settings=my_project.settings.production。但我不知道如何通过Procfile 做到这一点。

仅供参考,gunicorn --pythonpath=my_project my_project.wsgi --settings=my_project.settings.production 也不起作用。

【问题讨论】:

    标签: django heroku gunicorn procfile


    【解决方案1】:

    似乎我必须运行 heroku ps:scale web=1 才能使其正常工作。这很奇怪,因为我 100% 确定我之前启动了其他 Heroku 项目,而且我不必运行该命令就可以看到我的应用程序在 http://my_project.herokuapp.com 中运行。

    我的 Procfile 运行成功时是这样的:

    web: cd my_project; gunicorn my_project.wsgi --settings=my_project.settings.production

    编辑

    我之前使用 -w 1 选项运行 gunicorn:

    web: cd my_project; gunicorn my_project.wsgi -w 1 --settings=my_project.settings.production

    这可能激活了测功机。

    【讨论】:

      猜你喜欢
      • 2016-12-15
      • 2022-10-16
      • 2012-05-18
      • 2015-03-22
      • 2012-07-20
      • 2015-07-16
      • 2020-10-23
      • 2021-08-20
      • 2017-04-25
      相关资源
      最近更新 更多