Nine steps for practical application of Python Installation notes (1)

Source: Internet
Author: User

If you have some questions about the practical application of Python Installation notes, or you are a beginner in Python Installation notes, you can browse our article, I hope you will have some gains. The following is a detailed description of the article.

The following steps are some records of the configuration process. I hope it will be helpful to anyone who wants to use mod_python. Note the indentation of the test code.

1. Download a new version. Pay attention to apache and python versions)

2. Copy the package to a linux machine and execute Python Installation notes on the command line:

 
 
  1. tar -zxvf mod_python-3.3.1.tgz  
  2. cd mod_python-3.3.1  
  3. ./configure --with-apxs=/usr/local/apache/bin/apxs   

Configure the apxs directory

 
 
  1. ./configure --with-python=/usr/bin/python2.5   

Configure local python

 
 
  1. make  
  2. make install 

3. After compilation, mod_python.so will be generated in the apache/modules/directory, about 3 m.

4. Configure apache http. conf

 
 
  1. LoadModule python_module modules/mod_python.so  
  2. <Directory "/usr/modpython"> 

Directories that can be accessed using apache

 
 
  1. #AddHandler mod_python .py  
  2. SetHandler mod_python  
  3. PythonHandler mod_python.publisher  
  4. PythonDebug On  
  5. </Directory> 

5. Create a test. py file in the/usr/modpython/directory.

 
 
  1. #coding:gb2312  
  2. def index(req):  
  3. req.write("hello,world!")  
  4. return  

6. Run Python Installation notes. After apache startup is successful,


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.