繁体   English   中英

Django App在本地运行良好,但在Heroku上失败

[英]Django App works fine locally but fails on Heroku

我正在尝试在Heroku上部署此应用程序https://bitbucket.org/hybird/creme_crm-1.2 我遵循了指南https://devcenter.heroku.com/articles/django。该应用程序在使用django dev服务器或gunicorn并带有“ foreman start”的本地服务器上运行良好,但在Heroku上失败,并出现以下错误:

[INFO] Starting gunicorn 0.14.6
Starting gunicorn 0.14.6
[INFO] Listening at: http://0.0.0.0:16635 (2)
Listening at: http://0.0.0.0:16635 (2)
[INFO] Using worker: sync
Using worker: sync
[INFO] Booting worker with pid: 5
Booting worker with pid: 5
    response = view_func(request, *args, **kwargs)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/contrib/auth/views.py", line 69, in login
    context_instance=RequestContext(request, current_app=current_app))
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/template/context.py", line 172, in __init__
    for processor in get_standard_processors() + processors:
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/template/context.py", line 150, in get_standard_processors
    raise ImproperlyConfigured('Error importing request processor module %s: "%s"' % (module, e))
ImproperlyConfigured: Error importing request processor module creme_core.context_processors: "No module named creme"

该错误表明您缺少模块:creme_core

将项目部署到heroku时,heroku使用一个pip冻结要求文件,该文件包含项目中的所有模块。 Heroku在部署应用程序时会下载需求文件中的所有模块。

确保您有一个requirments.txt文件(pip冻结文件): 此处位于pip冻结下的文档中

问题是我正在从应用程序文件夹中推送到heroku。 假设我的应用程序位于文件夹creme中。 我必须创建一个包含creme文件夹,requirements.txt和Procfile的文件夹。 错误是我将需求和Procfile放在了creme文件夹中,它可以在localhost上运行,但不能在Heroku上运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM