[Tutor] [Almost OT]Getting Started with CGI

Adrian Maier am@fx.ro
Mon Apr 7 18:02:02 2003


Alan Colburn (aicolburn@yahoo.com) a scris :
> The problem, again, is whether I can set
> things up to run Python scripts. Do I need to get one
> of my campus network buddies to download and set up
> some sort of Python module? 

You might need to tell them to install Python itself.
It appears that Python comes with a module called 'cgi',
so i guess you won't need any additional modules
(but maybe you need modules for database access?)

> Is there a way for me to
> install files in my own cgi-bin directory, allowing me
> to be in control and run the scripts? (The campus uses
> some flavor of UNIX; I'm not up on Unix--I'm a Windows
> guy--but if I tell you it's  "IRIX64 swift 6.5" will
> that help?)

There are at least 2 ways for transferring your files to 
that directory:
1. use ftp to transfer the files.  

2. if you'll be able to get a "shell account" it would be 
great: this means that you'll be able to connect to that
server with ssh and type commands as if you were at the
console of that server. Cool, but you need to learn basic
UNIX commands. It depends on the admin if they create
such accounts or not.

> Bottom line: me and Python? OK. HTML? OK. CGI and/or
> UNIX? Not so OK. :-)

> Any suggestions about where to start? ... As always,
> thank you!

First, find out if they have Python installed on that
server. If not, convince them to install it.

Second, write your Python script. (i can't tell you much about
 this, except that there is a module called cgi. Read its docs.)

 The first line of the script will have to be something like:
  #!/usr/bin/python
 
This tells the operating system which is the interpreter to 
be used for executing your script ( ask the guys that administer 
the server about this: they know exactly where it is located).
  
Third, transfer your file to your directory on the server.
The admin should be able to tell you exactly how to do this.
Ask him to tell you how to set the file permissions 
(the script has to be set as executable with the chmod utility:
  chmod 704 your_script.py      )
 

I hope i wasn't too dense, but it's late here and i'm tired...

Best regards,
Adrian Maier
(am@fx.ro)