python - 如何修改 Procfile 以在 Heroku 上的非标准文件夹中运行 Gunicorn 进程?

标签 python django heroku wsgi gunicorn

我是 Heroku 和 Gunicorn 的新手,所以我不确定这是如何工作的。但我做了一些搜索,我想我已经接近部署我的 Django 应用程序(1.5.1)了。所以我知道我需要一个 Procfile 其中

web: gunicorn app.wsgi

因为我的目录有点不同。我无法在根目录中运行gunicorn

app_project
    requirements/
    contributors/
    app/
        app/
            settings/
            wsgi.py
        # Normally Procfile goes here
    Procfile

通常 app/是根目录,但我决定以这种方式构建我的文件夹,以将我的 django 应用程序与其他一些东西分开。由于我必须将 Procfile 放在根目录中才能让 heroku 识别它,所以我应该在 Procfile 中放入什么和/或应该在 Gunicorn 命令中放置哪些参数?

注意:

web: gunicorn app.wsgi # won't work because Procfile is in a directory above
                       # I also want to keep the directories as is
                       # I also don't want to create a secondary git inside the app folder just for heroku
web: gunicorn app.app.wsgi # won't work because I don't want to convert the folder into a python module

最佳答案

尝试:

web: gunicorn --pythonpath app app.wsgi

关于python - 如何修改 Procfile 以在 Heroku 上的非标准文件夹中运行 Gunicorn 进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55828868/

相关文章:

python - 循环遍历 pandas Dataframe 以从另一个 Dataframe 获取值

python - RuntimeError : 'list' must be None or a list, not <class 'str' > while trying to start celery worker

postgresql - Heroku super 用户查询阻止我获取 AccessExclusiveLock。我怎样才能放下一张 table ?

node.js - 具有组合前端和后端的应用程序未部署到 Heroku

python - 如何通过应用引擎上传sitemap.xml?

python - 如何在 freeNAS 操作系统上将 python 2.7 更新到 3.5

python - 为什么对 MySQL RDS 的 AWS Lambda python 调用会被缓存?

MySql表没有主键,django orm无法使用

python - 无法让 post_save 在 Django 中工作

ruby-on-rails - 在 Heroku 上运行 ruby​​ 1.9.2