蟒蛇和放大器; XAMPP在Windows上:怎么样? [英] Python & XAMPP on Windows: how to?
问题描述
我已经安装在我的Win7x64 Xampp时和Python 2.7。
I have installed on my Win7x64 Xampp and Python 2.7.
现在我试图让Python语言的权力......我该怎么办呢?
Now I'm trying to get the "power" of Python language... how can I do it?
我和mod_python的和mod_wsgi的,但第一次尝试了我的Python版本中并不存在,当我尝试安装后启动Apache WSGI它给了我一个错误
I've tried with mod_python and mod_wsgi but the first one does not exist for my version of Python, and when I try to start Apache after installing wsgi it gives me an error
< Directory "\x93C:/wsgi_app\x94"> path is invalid
我添加℃之间的空间;和目录,使这里的字符串是可见的。
I added a space between < and 'directory' to make the string visible here.
所以...任何人都知道,如果有一个小教程来安装这些功能?
So... Anyone knows if there is a little tutorial to install these features?
或者是有人是一种足以说明我一步一步我怎么办?
Or is anyone is kind enough to explain me step by step what shall I do?
感谢和抱歉,如果我不那么能解释我。
Thanks and sorry if i'm not so able to explain me.
如果你需要什么东西,请提问。
If you need something, please ask me.
推荐答案
是的,你是对的,mod_python的将不使用Python 2.7的工作。所以mod_wsgi的是你最佳的选择。
Yes you are right, mod_python won't work with Python 2.7. So mod_wsgi is the best option for you.
我会建议AMPPS为Python环境是与mod_python的和Python 2.5默认启用。 AMPPS网站
I would recommend AMPPS as python environment is by default enabled with mod_python and python 2.5. AMPPS Website
如果你仍想继续,
在httpd.conf
Add this line in httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
取消注释在httpd.conf
Uncomment the line in httpd.conf
Include conf/extra/httpd-vhosts.conf
打开虚拟主机文件的httpd-vhosts.conf并添加
Open vhost file httpd-vhosts.conf and add
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
<Directory "path/to/directory/in/which/wsgi_test.wsgi/is/present">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
ServerName 127.0.0.1
ServerAlias 127.0.0.1
WSGIScriptAlias /wsgi "path/to/wsgi_test.wsgi"
DocumentRoot "path/to/htdocs"
ErrorLog "path/to/log.err"
CustomLog "path/to/log.log" combined
</VirtualHost>
添加以下行wsgi_test.wsgi
Add the following lines in wsgi_test.wsgi
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
请注意:不要让测试目录htdocs中。因为我还没有试过呢。这些步骤AMPPS为我工作。 :)
Note : Don't make the test directory in htdocs. Because I haven't tried that yet. These steps worked for me in AMPPS. :)
然后在你喜欢的浏览器访问127.0.0.1/wsgi。你会看到的Hello World!
Then access 127.0.0.1/wsgi in your favorite browser. You will see Hello World!.
如果您没有看到,请按照 QuickConfigurationGuide
If you don't see, follow QuickConfigurationGuide
或
您可以在httpd.conf
You can add these lines in httpd.conf
<IfModule wsgi_module>
<Directory path/to/directory>
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
WSGIScriptAlias /wsgi path/to/wsgi_test.wsgi
</IfModule>
这篇关于蟒蛇和放大器; XAMPP在Windows上:怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!