简体   繁体   English

无法在Windows上本地运行Django heroku应用程序

[英]Cannot run Django heroku app locally on Windows

So, I want to test my app locally, but something goes wrong. 所以,我想在本地测试我的应用程序,但出了点问题。 After installing virtualenv , activating it, installing requirements.txt and running collectstatic I try to run app with 安装virtualenv ,激活它,安装requirements.txt并运行collectstatic我尝试运行app

heroku local web -f Procfile.windows

I get 我明白了

[OKAY] Loaded ENV .env File as KEY=VALUE Format

And that's all. 就这样。 I wait for about 30 mins and then stop execution. 我等了大约30分钟然后停止执行。 Then I get 然后我明白了

16:07:33 web.1   |  Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x042BEF60>
16:07:33 web.1   |  Traceback (most recent call last):

Traceback is empty. 回溯是空的。 This is all output. 这都是输出。 Sometimes, when I wait for about only 1-2 minutes no messages appear at all. 有时,当我等待大约1-2分钟时,根本不会出现任何消​​息。

File Procfile.windows looks like: 文件Procfile.windows看起来像:

web: python manage.py runserver 0.0.0.0:5000

What's wrong? 怎么了? Why this exception occurs? 为什么会发生此异常?

I'm also having the same issue; 我也有同样的问题; however, I noticed that the procfile command IS being run, but heroku is swallowing the console output. 但是,我注意到procfile命令正在运行,但是heroku正在吞咽控制台输出。 Which means if there is an error in the django code, the server silently does not start. 这意味着如果django代码中存在错误,则服务器将无法启动。

I can run manage.py runserver manually to see the console output, but that means having to configure the .env variables separately (which I'd rather not do, as I have multiple Heroku/Django apps locally). 我可以手动运行manage.py runserver来查看控制台输出,但这意味着必须单独配置.env变量(我不想这样做,因为我在本地有多个Heroku / Django应用程序)。

However, for some reason, if I save any project file (even with no changes) while the server is running, the console output starts to appear as expected 但是,出于某种原因, 如果在服务器运行时保存任何项目文件(即使没有更改),控制台输出将开始按预期显示

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

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