[COLUG] New Member and ISP Info
Tom Hanlon
tom at functionalmedia.com
Thu Dec 28 19:15:42 EST 2006
>
> --------------------------
>
> I have a question for the group. I have a small website for my
> company.
> I've never done any CGI programming, but it looks like it can be
> done in
> Python. Since I know Python, that's what I'd like to use.
> Unfortunately,
> it appears that my current web hosting service (DragonBBS) does not
> support Python. When I called tech support, they didn't even know what
> Python is. I'd like recommendations for an alternate web hosting
> service that does support Python for CGI. I'm looking for something
> inexpensive, my DragonBBS account is only $90 / year.
>
> --------------------------
They do not have to "support" python in order for it to work as a CGI
platform.
Do you have shell access ?
If so type
python -V .. what do you see ?
If Python answers back with a version number then type
which python
If you see the path to python then you are good to go. As long as
they support any type of CGI.
Here is what my mac said when I typed those commands.
Tom-Hanlons-MacBook:~ thanlon$ python -V
Python 2.3.5
Tom-Hanlons-MacBook:~ thanlon$ which python
/usr/bin/python
Tom-Hanlons-MacBook:~ thanlon$
So if I wanted a python CGI I would just.
Put a script in my web directory. I would follow whatever
instructions they may have for cgi scripts, ask for a sample cgi or
some instructions. They probably expect perl. How CGI works is apache
passes a request to the executable in the first line of the script.
What pages get treated as CGI are usually dependent on directory or
extension. If they expect perl call the script script.pl instead of
script.py .
So write a python script..
How do you print in python ?? I forget.
Something like
#!/usr/bin/python
print "
Content type text/html
print (blank line)
print html head, title, body , HELLO WORLD close body close html
Give it an extension that will get treated as a CGI script.
They expect perl so try script.pl , or script.cgi .
They may expect a directory (less likely than extension)
Create a directory cgi-bin and drop the script in that directory.
If you can look at your apache config file for the cgi directives
then it will all make sense.
I guess my point is that CGI is handled by any programing language
that the server understands.
Perl, Python, C, Bash, what ever.
The only trick is getting apache to handle it. I think it would be an
addtype or a files container directive that uses an extensin and
defines it as a CGI. Apache does NOT control what programming
language is used.
I have called my python scripts script.pl or script.cgi many times.
Regards,
Tom
More information about the colug432
mailing list