简体   繁体   English

将python用作在本地主机上使用的服务器脚本语言的最佳方法

[英]The best way to use python as a server scripting language for use on localhost

relatively long-time PHP user here. 相对长期的PHP用户。 I could install XAMPP in my sleep at this point to the point where I can get a PHP script running in the browser at "localhost", but in my searches to find a similar path using Python, I've run out of Googling ideas. 此时,我可以在睡眠中安装XAMPP,直到可以在浏览器的“本地主机”上运行PHP脚本,但是在使用Python查找相似路径的搜索中,我用完了Googling的构想。 I've discovered the mod_python Apache mod, but then I also discovered that it's been discontinued. 我发现了mod_python Apache mod,但是后来我也发现它已经停产了。 I'd greatly prefer to do my Python learning in a browser as opposed to the command prompt, so if anybody could point me along the proper path, I'd be very grateful. 我非常喜欢在浏览器中学习Python,而不是在命令提示符下学习Python,因此,如果有人可以指出我的正确路径,我将不胜感激。

Thanks! 谢谢!

well mod_python has been retired. 好mod_python已退休。 So in order to host python apps you want mod_wsgi 因此,为了托管python应用,您需要mod_wsgi

http://code.google.com/p/modwsgi/ http://code.google.com/p/modwsgi/

But python isn't really like php(as in you mix it with html to get output, if I understand your question correctly). 但是python并不是真的像php(因为我正确理解了您的问题,因此您将其与html混合以获取输出)。 In learning python, using the command line/repl will probably be much more useful/straight forward I would think. 在学习python时,使用命令行/ repl可能会更加有用/直截了当。 If you are looking for python as primarily web development you should look into django ( http://www.djangoproject.com/ ) as that might be closer to what you are looking for.. 如果您将python主要用作Web开发,则应研究django( http://www.djangoproject.com/ ),因为它可能更接近您的需求。

Most Python webframeworks have a built-in minimal development server: 大多数Python网络框架都具有内置的最小开发服务器:

But don't be afraid of the command line. 但是不要害怕命令行。 Python has a great interactive console (just run python ) and there's an even better one: IPython . Python有一个很棒的交互式控制台(只需运行python ),还有一个更好的控制台: IPython

Many options, here are a couple: 有很多选择,这里有几个:

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

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