[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Few Small Questions Regarding CGI

joy99

2/15/2010 10:05:00 PM

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.
5 Answers

John Gordon

2/15/2010 10:58:00 PM

0

In <631b0785-38db-4c12-a82a-7b11e2235e23@o16g2000prh.googlegroups.com> joy99 <subhakolkata1234@gmail.com> writes:

> Can I use my personal computer as a client as well as a server?

Yes, if you install a web server on your PC. You would then use
"localhost" in your browser instead of a standard web address.

Assuming you're running Windows, have a look at this page to download
the Apache web server:

http://mirror.candidhosting.com/pub/apache/httpd/binaries/win32/R...

--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

Jonathan Gardner

2/15/2010 11:52:00 PM

0

On Feb 15, 2:04 pm, joy99 <subhakolkata1...@gmail.com> wrote:
>
> 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.

Mel

2/16/2010 12:37:00 AM

0

joy99 wrote:

> 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.


Lawrence D'Oliveiro

2/16/2010 4:23:00 AM

0

In message <631b0785-38db-4c12-
a82a-7b11e2235e23@o16g2000prh.googlegroups.com>, joy99 wrote:

> Is there any other material or URL for step by step learning of CGI.

Thereâ??s the official spec here
<http://hoohoo.ncsa.illinois.edu/cgi/interfac....

Tim Roberts

2/16/2010 6:58:00 AM

0

joy99 <subhakolkata1234@gmail.com> wrote:
>
>I am trying to learn CGI. I was checking Python Docs. There are
>multiple modules. Which one to start with?

Well, it seems to me that the first place to start is the built-in CGI
module, in "cgi.py". I'm not aware of any other CGI-based modules in the
standard library.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.