本人使用的版本: Python 2.7.2; Apache/2.2.21 (Win32); 安裝難度在于沒有直接的mod_python 2.7版本的exe安裝包,需要自行編譯,好在有網友已經在網上分享了編譯成功的exe文件(mod_python-3.3.1.win32-py2.7),我把它存在微盤中,地址為:http://vdisk.weibo.com/s/32-mR 我是個暴力的拿來主義者,如果有想學習編譯過程的可從原作者文章里學習,地址為:http://blog.csdn.net/soaringsea/article/details/7193317 下面我又從外文網站找到了一篇關于安裝的詳細文章:(我尊重原文,但他安裝的版本和我有些出入,我稍作修改) 『原文的鏈接地址為:http://blog./installing-python-mod_python-on-xampp/』 So you want to get Python working with XAMPP eh? Me too! So, apparently, do a lot of people; and pretty much no one who knows how is saying how from what I’ve found online in my cursory 5 minute search. Let’s just jump right in, shall we? Resources:Step 0: Install XAMPP & PythonYou should have installed XAMPP already, but if you are a brand new “b” to the Server Side Dev ring, and you have stumbled upon this post looking for the catch all solution to getting your feet wet with Server Side Programming and have picked Python as your poison, go get XAMPP! It basically installs and configures itself, and there is an excellent tutorial on the apachefriends website to get you through this process: http://www./en/xampp-windows.html#641 You might not have installed Python already (although, if not, why did you choose Python over PHP or Ruby?). If you haven’t installed it already, go download and install it now: Step 1: Make a BackupIf you are like me, and have a few years worth of stuff in your XAMPP directory that you don’t want to ‘splode when you screw up the first time you try to get Python working with XAMPP, go ahead and just zip c:\xampp to x:\xampp-backup.zip now… Step 2: Download mod_pythonDownload mod_python now… http://httpd./modules/python-download.cgi Wait, which one do I download? Good question! Check your version of Apache and Python to determine which one you need
Step 3: install mod_python
Step 4: Configure Apache
Step 5: Testing Py!Point your browser to http://localhost/test/mptest.py You should see “Hello World!”. If you don’t, check this page out (and this one and this one). Also, make sure you got the path correct in the <Directory /> tag, and saved your mptest.py file to the right place. What’s next? Why not get a Python book? This one is really good: Or, why not check out some tutorials, starting with this one! (and check out this presentation on django) Edit: Some user comments: <Directory /test> … </Directory> <– This is wrong! But, the following works: <Directory “C:/xampp/htdocs/test”> … </Directory> instead on adding the directory block, which turns on mod-python for a single folder, add the following at the end of the file (assumes you want to use the Publisher handler): <IfModule python_module> If you have any other comments that require code. Just send me an e-mail (cmcculloh-at-gmail-dot-com) and I’ll post the code (so you don’t have to worry about it getting mangled). |
|