Python CGI Environment Setup

Source: Internet
Author: User
Tags iis administration

The general server can execute CGI scripts, the previous new scripting language Python,ruby, not popular, then all are written in Perl or C CGI script.

The client accesses these scripts over HTTPS, and the script executes on the server side, returning the results to the client.

    1. The server typically requires a Perl execution environment, or the CGI script is a compiled binary that runs directly from the OS. Then the python script will require the server and Python to explain the environment: install Python.
    2. After installation, if it is an IIS server, you need to add the Python.exe path in IIS administration, so that Python.exe has the executable permission on the root directory of the site: license.
    3. In addition, the website can recognize the files that were previously html,xhtml, we added. py

Then in Apache is also possible, the idea is in the http.conf inside, modify the contents of the inside, how to modify, there are ideas can Baidu, not nonsense

because Python is now as good as PHP for Dynamic web development, Apache can seamlessly connect with the Mod_wsgi.so module, just as Apache and PHP are partners, even though Python itself has a database for developers SQLite3, only import imports SQLite3 can be used, but the production environment is better with Apache.

The configuration process is also a modification of the Apache configuration file http.conf: Add python corresponding module mod_wsgi.so, if you want to install Python, the most basic, set the Python script file directory.

This allows you to access the local Python file. For example localhost:8081/py/index.py will explain the results of index.py, the site is the same bar. If http.conf is appended with the. py file type, the input will automatically access the index.py file: localhost:8081/py/

So Python is not necessary to set up CGI under Apache. My bright, huh? CGI script, at least the script execution results include the HTTP protocol header part, that is, the return result

Python CGI Environment Setup

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.