Few Small Questions Regarding CGI

J

joy99

Dear Group,

I am trying to learn CGI. I was checking Python Docs. There are
multiple modules. Which one to start with?
Is there any other material or URL for step by step learning of CGI.

My next question is:
I want to test it. I have a small personal computer. I have internet
but is connected by a service provider. I do not have personal web
page. Can I use my personal computer as a client as well as a server?

If your kind time permits to answer me these questions, I would be
hugely benefited.
Wishing you a happy day ahead,
Best Regards,
Subhabrata.
 
J

Jonathan Gardner

I am trying to learn CGI. I was checking Python Docs. There are
multiple modules. Which one to start with?
Is there any other material or URL for step by step learning of CGI.

I would suggest skipping 15 years of internet progress and going with
a more modern framework. I recommend Pylons, although Django and
web.py are not bad.
My next question is:
I want to test it. I have a small personal computer. I have internet
but is connected by a service provider. I do not have personal web
page. Can I use my personal computer as a client as well as a server?

Yes. The nature of the internet means anyone that connects can be a
client or a server or both at the same time.

Heck, you don't even need to have a connection to the internet. Just
play with 127.0.0.1, which points right back to the same machine
you're running on.

I do this all the time for developing and testing out websites or
change to websites I work on.
 
M

Mel

joy99 said:
Dear Group,

I am trying to learn CGI. I was checking Python Docs. There are
multiple modules. Which one to start with?
Is there any other material or URL for step by step learning of CGI.

My next question is:
I want to test it. I have a small personal computer. I have internet
but is connected by a service provider. I do not have personal web
page. Can I use my personal computer as a client as well as a server?

A server can be as simple as:



#!/usr/bin/env python
# -*- coding: ASCII -*-
'''Simple CGI server in Python
$Id$'''
import getopt, os, sys
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler

port = 8000
opts, args = getopt.getopt (sys.argv[1:], 'd:p:', ['www=', 'port='])
for o, v in opts:
if o in ['-d', '--www']:
os.chdir (v)
elif o in ('-p', '--port'):
port = int (v)

handler = HTTPServer (('', port), CGIHTTPRequestHandler)
handler.serve_forever()



If you run this like

mycgiserver.py --www=my_www_dir

and put your web pages under my_www_dir, and your CGI programs under
my_www_dir/cgi-bin

then pointing your browser to <http://localhost:8000/> will show you your
site.

Mel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top