简体   繁体   English

Django + Heroku-调试=错误问题

[英]Django + Heroku - Debug = False issues

I've been working on a website for a while now (Django/Python on Heroku). 我已经在网站上工作了一段时间(Heroku上的Django / Python)。 I usually have debug = true while developing, but now when I set to false I get 'application errors' from Heroku. 我通常在开发时将debug = true,但是现在当我设置为false时,我会从Heroku中得到“应用程序错误”。 My logs inform me that the issue is a "Request Interrupted" (H18, sock=backend). 我的日志告诉我该问题是“请求中断”(H18,sock = backend)。

I understand that this means that I have an error somewhere in my code, but for the life of me I cannot figure out where. 我知道这意味着我在代码中的某个地方出错,但是对于我一生来说,我无法弄清楚哪里。

I'm also having a hard time finding an efficient debugging work-flow when Debug=False. 当Debug = False时,我也很难找到有效的调试工作流程。 I have logentries and NewRelic for error monitoring on the Heroku app, but NewRelic reports 0 errors while logentries only gives me the default heroku-app error logs. 我在Heroku应用程序上有logentries和NewRelic来进行错误监视,但是NewRelic报告0个错误,而logentries仅给我默认的heroku-app错误日志。

I cannot possibly show you all my code (also I won't), so I realize that it'll be difficult for anyone to pinpoint my exact problem - therefore I am more asking in general terms. 我可能无法向您展示我的所有代码(我也不会),所以我意识到任何人都很难指出我的确切问题-因此,我更笼统地说。

I know that all URLs need to end with a slash, and that the ALLOWED_HOSTS setting is required - but what else can result in these errors when debug = false ? 我知道所有URL都必须以斜杠结尾,并且需要ALLOWED_HOSTS设置-但是当debug = false时,还有什么会导致这些错误?

Oh please note that EVERYTHING works as intended when debug is true. 哦,请注意,当调试为true时,一切都会按预期进行。

I'm running Django version 1.7 with Python version 2.7.6. 我正在运行Django版本1.7和Python版本2.7.6。

These are the 3rd party apps that I use: 这些是我使用的第三方应用程序:

  • Grappelli (loaded before default Django apps) Grappelli(在默认Django应用之前加载)
  • gunicorn 古尼康
  • storages 储物
  • compressor 压缩机
  • collectfast 快速收集
  • haystack 草垛
  • bootstrap3 bootstrap3
  • robots 机器人
  • sorl.thumbnail 指甲
  • django_countries django_countries
  • django_wysiwyg django_wysiwyg
  • validatedfile 验证文件
  • colorfield 色域
  • cookielaw Cookie法律

So I apparently discovered the culprit. 因此,我显然发现了罪魁祸首。 I was also using django-htmlmin , and for whatever weird reason that apparently caused my issues. 我还使用了django-htmlmin ,并且出于任何显然导致我的问题的奇怪原因。 I removed it and everything worked fine regardless of the debug setting. 我将其删除,无论调试设置如何,一切都正常。 Yay! 好极了!

I don't have the insight to say why django-htmlmin was causing these issues, although I suspect it might be incompatible with Django 1.7 or Django-Compresser. 尽管我怀疑django-htmlmin可能与Django 1.7或Django-Compresser不兼容,但我没有洞察力来说明 django-htmlmin 为何引起这些问题。

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

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