Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 26th, 2006, 11:33 AM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It's not that CGI is bad, but that frameworks such as CherryPy offer numerous advantages and no real disadvantages over it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 26th, 2006, 12:42 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
A very real disadvantage is that your host might not provide it. My host just now added Python. The word, Python, is now in the advertising blurbs, but there isn't a single word anywhere else telling how you need to use it. There's a lot on PHP, Ruby on Rails, etc., so I presume SOME instructions or a FAQ will eventually appear, but who knows where the wild goose goes when it snows?

At any rate, I just harked back to my Perl days and bumbled through it, and eventually noticed the cgi module, and Bob's your aunt.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 26th, 2006, 1:41 PM   #13
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by titaniumdecoy
Why is CGI so bad? Would you suggest using CherryPy like Sane?
CGI is lowest common denominator stuff. It's both the slowest, and most basic, way in which to use Python to create a web app.

I'd be tempted by Django or Turbogears for a project of reasonable size. Smaller projects I'd use PHP for, I think. Perhaps mod_python if it were available.

But if you wish to use Python, and your host doesn't have mod_python or FastCGI or whatever, you're pretty much stuck with basic CGI.
Arevos is offline   Reply With Quote
Old May 26th, 2006, 3:41 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It might be worth nothing that CGI is an interface specification and that many "non-cgi" approaches are merely CGI wrappers. It is actually a standard dealing with interfacing with protocols such as http.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 26th, 2006, 4:11 PM   #15
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Although my knowledge of CGI is somewhat limited, I don't think that's altogether the case, DaWei. CGI is a way of encoding information about a HTTP request that can be passed into the STDIN of an external program.

The problem with this approach is that it requires a new instance of the program for every HTTP request. FastCGI gets around this problem by caching the program in memory, but it describes itself as an "open extension to CGI", indicating that it's doing something outside the CGI spec. So far as I know, CGI itself is fairly primative.

A fair few web programming languages nowadays can connect directly to the server through binary interfaces. ASP, PHP, mod_perl, mod_python J2EE and so forth take this approach, and I'd imagine that's the majority of the net right there.

Another technique which is gaining in popularity is to wrap the HTTP server with the programming library. CherryPy, Turbogears, Ruby on Rails and Django default to this position. This gives the developers somewhat more control than they would have otherwise.

CGI by itself is probably fairly rare. When it does show up, it's either for small applications or extended somehow with a binary interface that caches the executed programs. Otherwise, it just doesn't scale particularly well.
Arevos is offline   Reply With Quote
Old May 26th, 2006, 4:43 PM   #16
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
many "non-cgi" approaches are merely CGI wrappers.
The fact that it is a standard doesn't mean that an implementation has to use it. It remains, nevertheless, quite pervasive.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 26th, 2006, 5:03 PM   #17
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Mm, well, I'd still debate that "many" non-CGI approaches are CGI wrappers, though it rather depends on the definition of "many", and that hardly seems worth arguing. Suffice to say that I'd consider CGI wrappers, and CGI in general to be in the minority. I suspect server-specific binary interfaces are the most common method of tying web applications to web servers.
Arevos is offline   Reply With Quote
Old May 26th, 2006, 5:58 PM   #18
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I think we differ on our interpretation of the meaning of CGI, and that the resolution isn't worth pursuing. If I happen to stumble over any figures, I'll suck 'em up, but I ainnagonnago looking this month or next. I'd be interested in hearing anything you stumble across, though. I can't keep up, that's for sure.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 26th, 2006, 6:08 PM   #19
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by DaWei
If I happen to stumble over any figures, I'll suck 'em up, but I ainnagonnago looking this month or next. I'd be interested in hearing anything you stumble across, though.
To be honest, I don't think I'll be hunting around for CGI figures, either
Arevos is offline   Reply With Quote
Old May 26th, 2006, 8:31 PM   #20
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 931
Rep Power: 4 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Well, my real issue here is that I'm looking for a way to access these variables that is portable--I am writing a script that needs to work without having to install anything besides Python itself. Do any of these modules (the Python CGI module, mod_python, CherryPy, etc.) come standard with a basic installation of Python?

Also it seems like a bad idea to have so many different ways to go about doing the same thing. It would make it much more difficult for other programmers to maintain Python code if they have to learn a new module/method each time.
titaniumdecoy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC