Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Write web apps in Python?

Reply
Thread Tools

Write web apps in Python?

 
 
Gilles Ganault
Guest
Posts: n/a
 
      04-12-2010
Hello

I'd like to make sure I understand what the options are to write web
applications in Python:

- à la PHP, using Apache's mod_python

- using eg. Lighttpd and configuring it to load the Python interpreter
every time a Python script is called (www.jakehilton.com/?q=node/54)

- long-running process, by compiling the Python script as a
stand-alone program that will then wait for queries on a port and
being called by the web server through eg. the WSGI

As for writing apps, I can either built it from scratch, or use
frameworks like Pylons, TurboGears, or Django.

Is this correct?

Thank you.
 
Reply With Quote
 
 
 
 
Daniel Fetchinson
Guest
Posts: n/a
 
      04-12-2010
> I'd like to make sure I understand what the options are to write web
> applications in Python:
>
> - à la PHP, using Apache's mod_python
>
> - using eg. Lighttpd and configuring it to load the Python interpreter
> every time a Python script is called (www.jakehilton.com/?q=node/54)
>
> - long-running process, by compiling the Python script as a
> stand-alone program that will then wait for queries on a port and
> being called by the web server through eg. the WSGI
>
> As for writing apps, I can either built it from scratch, or use
> frameworks like Pylons, TurboGears, or Django.
>
> Is this correct?


Basically, yes.

For additional info have a look at http://wiki.python.org/moin/WebProgramming

Cheers,
Daniel



--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
 
Reply With Quote
 
 
 
 
Gilles Ganault
Guest
Posts: n/a
 
      04-12-2010
On Mon, 12 Apr 2010 12:13:17 +0200, Daniel Fetchinson
<(E-Mail Removed)> wrote:
>For additional info have a look at http://wiki.python.org/moin/WebProgramming


Thanks for the link.
 
Reply With Quote
 
Luis M. González
Guest
Posts: n/a
 
      04-12-2010
On 12 abr, 06:57, Gilles Ganault <(E-Mail Removed)> wrote:
> Hello
>
> I'd like to make sure I understand what the options are to write web
> applications in Python:
>
> - à la PHP, using Apache's mod_python
>
> - using eg. Lighttpd and configuring it to load the Python interpreter
> every time a Python script is called (www.jakehilton.com/?q=node/54)
>
> - long-running process, by compiling the Python script as a
> stand-alone program that will then wait for queries on a port and
> being called by the web server through eg. the WSGI
>
> As for writing apps, I can either built it from scratch, or use
> frameworks like Pylons, TurboGears, or Django.
>
> Is this correct?
>
> Thank you.


You should first investigate the different python web frameworks,
choose one and then use the deployment options supported by your
choice. These frameworks support several ways to deploy your apps,
such as those you mentioned.

If you want an easy way to get started for free, check the Google App
Engine.
It's the google infraestructure to host web apps (written in python or
Java), and it's free as long as you don't surpass the limited quotas
on bandwith and data used (which are quite generous). You don't need
to set up anything. All you need is a google account to get started.

Luis
 
Reply With Quote
 
Stefan Behnel
Guest
Posts: n/a
 
      04-12-2010
Gilles Ganault, 12.04.2010 11:57:
> I'd like to make sure I understand what the options are to write web
> applications in Python:
>
> - à la PHP, using Apache's mod_python
>
> - using eg. Lighttpd and configuring it to load the Python interpreter
> every time a Python script is called (www.jakehilton.com/?q=node/54)
>
> - long-running process, by compiling the Python script as a
> stand-alone program that will then wait for queries on a port and
> being called by the web server through eg. the WSGI


Those are "deployment" options, not "write" (== design/implementation)
options. If you stick to a WSGI compatible framework, you are free to
deploy your application any way you like or need, depending on the specific
context or environment.


> As for writing apps, I can either built it from scratch, or use
> frameworks like Pylons, TurboGears, or Django.


Amongst tons of other options, as already pointed out.

Stefan

 
Reply With Quote
 
Gilles Ganault
Guest
Posts: n/a
 
      04-15-2010
On Mon, 12 Apr 2010 05:37:54 -0700 (PDT), Luis M. González
<(E-Mail Removed)> wrote:
>You should first investigate the different python web frameworks,
>choose one and then use the deployment options supported by your
>choice. These frameworks support several ways to deploy your apps,
>such as those you mentioned.


Thanks for the feedback. I wanted to have the big picture of the
different ways to write web applications in Python before checking the
different solutions.

So it looks like, unlike PHP, the prefered solution in Python is to
build a complete application as a long-running process, and either use
its embedded web server or configure a stand-alone web server to act
as reverse proxy using either FastCGI or WSGI to connect the two.
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      04-15-2010
Gilles Ganault a écrit :
> So it looks like, unlike PHP, the prefered solution in Python is to
> build a complete application as a long-running process, and either use
> its embedded web server or configure a stand-alone web server to act
> as reverse proxy using either FastCGI or WSGI to connect the two.


Yeps. You'll find the same pattern with most general purpose programming
languages, and specially OO ones.

The PHP execution model (mostly based on CGI FWIW) tends to be a bit
unpractical for non-trivial applications since you have to rebuild the
whole world for each and any incoming request, while with a long-running
process, you load all your libs, parse your config etc only once.

Also, gateways like FastCGI or WSGI avoids being tied to a specific web
server.
 
Reply With Quote
 
Gilles Ganault
Guest
Posts: n/a
 
      04-15-2010
On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
<(E-Mail Removed)> wrote:
>The PHP execution model (mostly based on CGI FWIW) tends to be a bit
>unpractical for non-trivial applications since you have to rebuild the
>whole world for each and any incoming request, while with a long-running
>process, you load all your libs, parse your config etc only once.


Apart from the ease of having the application run at all times, I'd be
curious to read about an application that was written in PHP and then
a long-running process and see if performance improved.

Regardless, Python has an easier syntax, so AFAIC, that's already a
good enough reason to use this to write web apps.
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      04-19-2010
Gilles Ganault a écrit :
> On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
> <(E-Mail Removed)> wrote:
>> The PHP execution model (mostly based on CGI FWIW) tends to be a bit
>> unpractical for non-trivial applications since you have to rebuild the
>> whole world for each and any incoming request, while with a long-running
>> process, you load all your libs, parse your config etc only once.

>
> Apart from the ease of having the application run at all times, I'd be
> curious to read about an application that was written in PHP and then
> a long-running process and see if performance improved.


I'm not sure there's a way to do such a thing in PHP, at least in a way
that wouldn't make the whole benchmark totally meaningless. And trying
to compare a PHP app with a similar non-PHP would also be (mostly)
meaningless.

Now there are a couple Symfony / Django benchmarks around (Symfony being
probably the closest thing to Django in the PHP world). They are just as
reliable as most benchmarks (that is, at best a rough indicator once you
understand what's effectively being measured), but it seems that they
confirm the empirical evidence that PHP is not well suited for such
"heavy" OO frameworks.

>
> Regardless, Python has an easier syntax, so AFAIC, that's already a
> good enough reason to use this to write web apps.


Indeed !-)
 
Reply With Quote
 
Bryan
Guest
Posts: n/a
 
      04-20-2010
Bruno Desthuilliers wrote:
> Gilles Ganault a écrit :
> > Apart from the ease of having the application run at all times, I'd be
> > curious to read about an application that was written in PHP and then
> > a long-running process and see if performance improved.

>
> I'm not sure there's a way to do such a thing in PHP, at least in a way
> that wouldn't make the whole benchmark totally meaningless.


I think you guys got some incorrect info about PHP. A variety of
execution options are available, such as FastCGI and in-server
modules. PHP frameworks generally allow and encourage application code
to be independent of the underlying plumbing. Many large,
sophisticated, high-volume web apps are in PHP.

We like Python 'round here, but PHP, Ruby, Perl, Java, and others are
viable languages for web apps. Each has its distinguishing features --
how efficiently a web app gets invoked is not among them. It's not a
language issue. What was the theory here? Did we think the PHP
community too stupid to understand FastCGI?


--
--Bryan Olson
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET 2.0 Web Apps / .NET 3.5 ASP.NET Apps - Differences/Similariti london1919 MCTS 1 12-08-2008 03:16 PM
Which do you prefer? MCTS: Web Apps or MCTS: Windows Apps? Willy David Jr MCTS 3 01-09-2007 05:49 AM
Running python apps from within python apps aph Python 4 01-14-2006 04:06 PM
Call windows apps from web apps anonymous ASP .Net Datagrid Control 4 02-28-2005 01:25 PM
Web enabled apps/Thin client apps Richard Choate ASP General 2 07-23-2003 02:28 PM



Advertisments