Python Web CGI Programming Start

  • To get everything working for your App.py on web, you need
    1. Make sure your Web server has register handler for Py file as cgi-script file, mostly likely hosting provide that support python already add that handler, but for local test like xampp, make sure Apache config setting has .py included like this
      AddHandler cgi-script .cgi .pl .asp .py
    2. add your server python version path to first line of App.py,
      1. linux example:
        #!/usr/bin/python
      2. windows example:
        #!C:/Python27/python
    3. put your App.py in cgi-bin folder in your web host or other place
    4. after upload, change file permission to 755

Web System Optimize