小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

在Xampp中安裝mod_python(windows環(huán)境)

 JasonQue 2012-03-08
本人使用的版本:
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 & Python

You 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:

http://www./download/

Step 1: Make a Backup

If 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_python

Download 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

  1. Enter the text (leave out the space between phpinfo and ()):
    <? phpinfo (); ?>
    into a new text document in notepad.
  2. Save the document as “test.php” (or something) in the htdocs directory of your xampp install.
  3. Start Apache (open the xampp control panel, c:\xampp\xampp-control.exe, and click “Start” next to Apache).
    NOTE: If you have IIS running, stop it. (Control Panel, Administrative Tools, Services, IIS Admin, Stop (say yes to stopping those other services too). If you scroll up to “Apache” at this point and click on it, you will see which version you are running and can skip to the next step in the mod_python install).
  4. Browse to the document you saved in step 2 through your web browser (localhost\test.php). You can NOT just double click the file and expect it to be parsed by apache and run…
  5. Scroll down and view the output in the “apache2handler” section. The first box in the table should be “Apache Version” and should tell you which version of Apache you are running (mine is 2.2.4, so I downloaded the very last “.exe” file so that I would have Python 2.5 w/ Apache 2.2)  (用python2.7的朋友可以從我的微盤里下載經過編譯的2.7版本)

Step 3: install mod_python

  1. Double click the exe file
  2. Click “Next”
  3. It should find your Python install. If you have more than one version, select the one you want to use. Click “Next”
  4. Click “Next”
  5. There should be a pop-up asking where Apache is installed. If you installed xampp to c:\, then this will be c:\xampp\apache

Step 4: Configure Apache

  1. Open c:\xampp\apache\conf\httpd.conf
  2. Scroll down to the section with all the “LoadModule” lines (about line #67) and add this line:
    LoadModule python_module modules/mod_python.so

    Note: If you are unable to start Apache after this, go back and type the line in the conf file by hand instead of copying/pasting.

  3. Scroll down to the section with the <Directory “/xampp/htdocs”> tag ends (about line #232) and add these lines following the closing </Directory> tag:
    <Directory "C:/xampp/htdocs/test">
            AddHandler mod_python .py
            PythonHandler mptest
            PythonDebug On
    </Directory>
  4. Save and close the file.
  5. Restart Apache
  6. Create a new file (and folder) c:\xampp\htdocs\test\mptest.py
  7. Place the following text in the file, and save it (watch your formatting, Python is whitespace sensitive!):
    from mod_python import apache
    
    def handler(req):
    	req.content_type = 'text/plain'
    	req.write("Hello World!")
    	return apache.OK

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:
Game Programming: The L Line, The Express Line to Learning (The L Line: The Express Line To Learning). That’s right! Game programming in Python.

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>
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</IfModule>

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).




    本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多