Django应用程序在本地运行良好,但在Heroku上失败
我正在尝试在Heroku上部署此应用程序。 我跟着导游走 该应用程序在使用django dev server或带有“foreman start”的gunicorn的本地服务器上运行良好,但在Heroku上失败,出现以下错误:Django应用程序在本地运行良好,但在Heroku上失败,django,heroku,Django,Heroku,我正在尝试在Heroku上部署此应用程序。 我跟着导游走 该应用程序在使用django dev server或带有“foreman start”的gunicorn的本地服务器上运行良好,但在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
[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在部署应用程序时下载需求文件中的所有模块
确保你有一个requirements.txt文件(pip freeze文件):它在pip freeze下的文档中。问题是我从应用程序文件夹中推到了heroku。
假设我的应用程序在creme文件夹中。我必须创建一个包含creme文件夹、requirements.txt和Procfile的文件夹。错误是我将requirements和Procfile放在creme文件夹中,它在localhost上工作,但在Heroku上不工作。我有一个requirements.txt文件,但creme_core已经在我推送到Heroku的源代码中,它是web应用程序的一部分。正如我所说,该应用程序在localhost上运行良好。经过一些研究,它看起来是一个与您的需求无关的错误。这更多的是一些本地VAR的错误配置。具体来说,它看起来与设置文件中的上下文处理器var有关