| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

WebApplication

Page history last edited by PBworks 17 years, 1 month ago

Web Application

 


 

Your own CGI web server on localhost

code by effbot:

 

import CGIHTTPServer

import BaseHTTPServer

class Handler(CGIHTTPServer.CGIHTTPRequestHandler):

    cgi_directories = ["/cgi"]

PORT = 8000

httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler)

print "serving at port", PORT

httpd.serve_forever()

 

  • create directory for CGI server, ie. /cgihome with subdirectories ./cgi and ./server
  • save code above as file cgihttpserver.py into directory /cgihome/server
  • open commadline teminal, and run commands "cd /cgihome" and "python server/cgihttpserver.py" - server runs at localhost, port 8000
    • on Windows, you can also create icon to run it
  • put any static html page into /cgihome - it is served from http://localhost:8000/page.html
  • put any CGI program into /cgihome/cgi - it is served http://localhost:8000/cgi/scriptname.py
  • to stop server, close the commandline window

 

Introduction

 

*

 

Using templates

  • htmltmpl is the best from simple templating engines: has all you need, but no extra features! :-)
  • TurboGears has excellent KID template system

Comments (0)

You don't have permission to comment on this page.