हाँ आप सही हैं, mod_python पायथन 2.7 के साथ काम नहीं करेगा। तो mod_wsgi आपके लिए सबसे अच्छा विकल्प है।
मैं एएमपीपीएस की सिफारिश करता हूं क्योंकि पाइथन पर्यावरण डिफ़ॉल्ट रूप से mod_python और पायथन 2.5 के साथ सक्षम है। AMPPS Website
अगर आप अभी भी जारी रखना चाहते हैं,
httpd.conf में इस लाइन जोड़े
LoadModule wsgi_module modules/mod_wsgi.so
टिप्पणी हटाएं httpd.conf में लाइन
Include conf/extra/httpd-vhosts.conf
ओपन vhost फ़ाइल httpd-vhosts .conf और
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>
01 जोड़ें
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 में परीक्षण निर्देशिका मत करना। क्योंकि मैंने अभी तक कोशिश नहीं की है। ये कदम एएमपीपीएस में मेरे लिए काम करते थे। :)
फिर अपने पसंदीदा ब्राउज़र में 127.0.0.1/wsgi तक पहुंचें। आप हैलो वर्ल्ड देखेंगे!
यदि आप नहीं देखते हैं, QuickConfigurationGuide
या
आप 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>
अब यह मुझे "त्रुटि 500" या "त्रुटि 403" देता है :( – Bonny1992