Django 1.2.3 与 python 2.5.2 兼容吗?奇怪的 django 行为

发布于 2024-10-20 22:29:05 字数 538 浏览 0 评论 0原文

今天的主要问题是 django 在 python 2.5.2 下能正常工作吗?

那么我为什么要问这个问题呢?

首先,我编写了一些测试类,没有什么特别的来呈现页面。问题是,每次我访问此页面时,我都会收到随机 3 个不同的响应:

1)异常必须是类、实例或字符串(已弃用),而不是类型

2)Http404

3)页面正常渲染。

一般来说,我可以刷新直到得到我想要的结果,在我的情况下通常呈现页面。我有点困惑,甚至想什么。因为我的书面课程几乎什么也没做。只是一个测试课程来测试一些东西。

我在 Debian 上的 python 2.5.2 下运行 Django 1.2.3 。

还有我注意到的。我通过远程主机使用 PyCharm 1.1.1,每次进行更改时都会自动上传,它会上传,但不知何故,在初始上传后并不总是应用更改。我的意思是,感觉文件没有编译~~如果你可以这样说的话...

它与 python 和 django O_O 基本上没有任何关系,还有其他一些奇怪的 bugz 有什么机会?

Well main question of the day will django work correctly under python 2.5.2 ?

So why i am asking this question?

First of all i have some test class written , nothing special which renders a page. The problem is that everytime i access this page i get random 3 different responses :

1)exceptions must be classes, instances, or strings (deprecated), not type

2) Http404

3) page renders normally .

And generally i can refresh until i get the result i want , well in my case normally rendered page. I am a little bit confused what even to think . Because my written class does pretty much nothing.Just a test class to test some things.

I run Django 1.2.3 under python 2.5.2 on Debian .

Also what i noticed . I use PyCharm 1.1.1 through remote host with auto upload every time change is made , it uploads but somehow changes are not always applied after initial upload . What i mean is that it feels like files are not compiled ~~ if u can say it this way ...

What's teh chance that it has basically nothing to do with python and django O_O and that are some other weird bugz ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

地狱即天堂 2024-10-27 22:29:05

是的,它是兼容的:
http://docs.djangoproject.com/en/dev/releases/ 1.2/#python-compatibility

发布你的类——可能有成千上万的原因导致它无法正常工作。

PyCharm 和您的主机不更新主机上的文件与 Python 或 Django 无关,而与 PyCharm 及其如何上传到您的主机有关。

Yes, it is compatible:
http://docs.djangoproject.com/en/dev/releases/1.2/#python-compatibility

Post your class -- there could be thousands of reasons it's not working correctly.

PyCharm and your host not updating files on your host would have nothing to do with Python or Django, but rather PyCharm and how it's uploading to your host.

A君 2024-10-27 22:29:05

经过更彻底的搜索后,我发现了这个主题 Restarting a Django application running在 Apache + mod_python 上,这可能解释了一切。除了我仍然不太明白为什么 mod_python 有时会应用更改而无需重新启动 apache 有时我不会..

After a more thorough search i found this topic Restarting a Django application running on Apache + mod_python , which explains probably everything. Except i still don't really understand why mod_python sometimes does apply changes without apache being restarted sometimes i doesn't ..

凉城 2024-10-27 22:29:05

默认情况下,mod_python 决定何时重新加载,因此当你得到它时,你就会得到你得到的东西。

也许我错了,但我认为您可以发送一个指令来显式强制 python 重新加载现在。这(理论上)应该有助于实现一致但可能不理想的行为。

题外话,这听起来是一个增强应用程序日志记录的好机会,这样下次出现问题时您将有更好的面包屑跟踪。

By default mod_python decides when to reload, so you'll get what you get when you get it.

Maybe I am mistaken, but I thought there was a directive you could send that would explicitly force the python reload now. That should (in theory) help with achieving consistent but perhaps not ideal, behavior.

Off topic, this sounds like a good opportunity to enhance your app's logging so you'll have better breadcrumbs to follow next time things hang.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文