Install mod_python in Windows

Source: Internet
Author: User

Today, I started to study the Web framework under python, found mod_python, Django, cherrypy and other architectures, learned about each of them, and installed them separately for testing, next we will summarize the installation of mod_python.
Install Apache
Download Apache: http://apache.justdn.org/httpd/binaries/win32/apache_2.0.58-win32-x86-no_ssl.msi

Install it in windows. Disable the IIS service before installation to prevent port occupation. Some errors occurred during installation, mainly httpd. serveradmin in conf is not set, so be sure to set the value such as xxxxx@gmail.com during installation, after the installation is complete, Apache will be automatically installed into the service, if it can be started successfully OK.

Install Python and mod_python
Download activepython and install, http://downloads.activestate.com/ActivePython/windows/2.4/ActivePython-2.4.3.12-win32-x86.msi
Download and install it directly.
Download mod_python
Http://apache.justdn.org/httpd/modpython/win/3.2.8/mod_python-3.2.8.win32-py2.4.exe
After installation, mod_python is placed in the python Lib.
Configure mod_python
After installing the above three software, you need to configure Apache to start mod_python. Open CONF/httpd. conf in the Apache installation directory and make the following changes:
1. Add loadmodule python_module modules/mod_python.so to the loadmodule section.
2. Modify the DocumentRoot value and point it to the working directory, for example, DocumentRoot "C:/pweb"
3. Add <directory "C:/pweb">

# Be sure to note that the following line has a space in front.
Addhandler mod_python. py
Pythonhandler mytest
Pythondebug on
</Directory>
Addhandle indicates that if you get all. py files in this directory, use mod_python to process them;
Pythonhandler mytest is the default file. The file executed when "/" is obtained;
Pythondebug on enables the debug switch. If an error occurs, you can see the error call stack information in the browser.
4. Compile mytest. py
From mod_python import Apache
Def handler (req ):
Req. Write ("Hello world! ")
Return Apache. ok5, test
Restart the apache service and enter:
Http: // localhost/
If you can see hello World! It indicates that mod_python works normally.
 
The Installation Process of mod_python is briefly described above. For the usage, classes, and functions of mod_python, see the documentation of mod_python.
 
Expansion
On the basis of mod_python, I feel that I can develop a set of my own Web architecture. Of course, there is a ready-made architecture, and Django is a good one. So let's take a good look at Django.

This article from the csdn blog, source: http://blog.csdn.net/kernelspirit/archive/2006/12/06/1431813.aspx

Related Article

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.