用于在 Apache 中进行 Web 开发的 Python

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/215815/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:54:05  来源:igfitidea点击:

Python for web development in Apache

pythonapachemod-python

提问by nosklo

I've been playing with mod_python in apache2 which seems to work differently than python does in general - there's a bit different syntax and things you need to do. It's not very well documented and after a few days of playing with it, I'm really not seeing the point of mod_python at all, especially when things like php are so well documented and available.

我一直在 apache2 中使用 mod_python,它的工作方式似乎与一般的 python 不同 - 有一些不同的语法和你需要做的事情。它没有很好的文档记录,在玩了几天之后,我真的完全没有看到 mod_python 的意义,尤其是当像 php 这样的东西有很好的文档记录和可用时。

I can see how Python works well for system programming, but can anyone give any information as to why I shouldn't just dump python for a web-based application?

我可以看到 Python 如何很好地用于系统编程,但是谁能提供有关为什么我不应该为基于 Web 的应用程序转储 Python 的任何信息?

回答by nosklo

  1. Don't use mod_python. A common mistake is take mod_python as "mod_php, but for python" and that is not true. Use mod_wsgiinstead.
  2. Choose a web framework. CherryPy. Pylons. Django.
  3. Look at wsgi.org
  1. 不要使用 mod_python。一个常见的错误是将 mod_python 视为“mod_php,但对于 python”,事实并非如此。请改用mod_wsgi
  2. 选择一个网络框架。樱桃派塔架姜戈
  3. 看看wsgi.org

回答by Jason Baker

mod_python wasn't really made for doing basic webprogramming. I suggest you go with a framework:

mod_python 并不是真正用于进行基本的网络编程。我建议你使用一个框架:

My suggestion is to give python some time. It's easy to get simplicity and lack of power confused. :)

我的建议是给python一些时间。很容易混淆简单性和缺乏力量。:)