Re: Yet Another Python Web Programming Question

2005-07-12 Thread Thomas Bartkus
"Daniel Bickett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> It was his opinion that
> web programming should feel no different from desktop programming.


Should that ever become even remotely possible -

I'll be interested in web programming myself.
Thomas Bartkus


-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Yet Another Python Web Programming Question

2005-07-12 Thread Sells, Fred
FWIW there's  "dos2unix" program that fixes this on most systems.

-Original Message-
From: Bill Mill [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 11:55 AM
To: Daniel Bickett
Cc: python-list@python.org
Subject: Re: Yet Another Python Web Programming Question


> Python using CGI, for example, was enough for him until he started
> getting 500 errors that he wasn't sure how to fix.

A common error is that python cgi files need line endings to be in
unix text file format, not windows text file format (\n instead of
\r\n) [1]. Why this is, I don't know, but it causes a lot of errors
for windows folks. I'm a frequent linux/windows switcher, and it's
caused me no end of troubles - if you're getting "premature end of
script headers" in your apache error logs, this may be your problem.

Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list

---
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-11 Thread Bill Mill
> Python using CGI, for example, was enough for him until he started
> getting 500 errors that he wasn't sure how to fix.

A common error is that python cgi files need line endings to be in
unix text file format, not windows text file format (\n instead of
\r\n) [1]. Why this is, I don't know, but it causes a lot of errors
for windows folks. I'm a frequent linux/windows switcher, and it's
caused me no end of troubles - if you're getting "premature end of
script headers" in your apache error logs, this may be your problem.

Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-10 Thread Sybren Stuvel
Daniel Bickett enlightened us with:
> It would be a long while before he would find Python, and since that
> time he would have no desire to ever touch PHP again.

My thoughts exactly.

> He would, however, be compelled to write a web application again,
> but in Python now, of course.

Same here :)

> * They required installation (as opposed to, simply, the placement
> of modules), whereas the only pythonic freedom he had on his hosting
> was a folder in his /home/ dir that was in the python system path.

I can't help you here. For instance, if you want to get a proper
performance, you should install something like mod_python to get
Python functionality in Apache.

> Python using CGI, for example, was enough for him until he started
> getting 500 errors that he wasn't sure how to fix.

Check the web server's error logs.


My solution was to take a look at Cheetah. It's a template engine
that's written in Python. I've written a mod_python handler for it so
I can easily create & edit my website using Cheetah as a template
engine. Check out http://www.unrealtower.org/mycheetah if you want to
read more about the handler & other stuff I wrote. Perhaps you can
even help me improve it!

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Yet Another Python Web Programming Question

2005-07-10 Thread Robert Brewer
Paul Boddie wrote:
> "Robert Brewer" <[EMAIL PROTECTED]> wrote in message 
> news:<[EMAIL PROTECTED]>...
> > Daniel Bickett wrote:
> > > I neglected to mention an important fact, and that is the 
> > > fact that I am limited to Apache, which elminates several
> > > suggestions (that are appreciated none-the-less).
> > 
> > Do you have access to mod_python, mod_rewrite, FastCGI, or 
> > SCGI? Then CherryPy 2.1 is still a great option for you with
> > Apache:
> > http://www.cherrypy.org/wiki/WSGIServers
> > http://www.cherrypy.org/wiki/BehindApache
> 
> According to the "quick facts" page "CherryPy powered web
> applications are in fact stand-alone Python applications embedding
> their own multi-threaded web server", suggesting that if the hosting
> environment is "limited to Apache" and if this can also be taken to
> mean that the environment doesn't permit long-running server processes
> apart from Apache, then CherryPy isn't likely to be suitable.

Thanks for pointing that out; that page was out of date, and has now
been corrected: http://www.cherrypy.org/wiki/CherryPyQuickFacts .
CherryPy 2.1 apps can be deployed using Apache (via mod_python) or IIS
(via ASP) as the webserver *without* running the webserver built into
CherryPy. In fact, CherryPy should work with any WSGI-capable webserver,
and be deployable in a wide variety of hosting environments with no
changes to your application code.


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-10 Thread Paul Boddie
"Robert Brewer" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Daniel Bickett wrote:
> > I neglected to mention an important fact, and that is the fact that I
> > am limited to Apache, which elminates several suggestions (that are
> > appreciated none-the-less).
> 
> Do you have access to mod_python, mod_rewrite, FastCGI, or SCGI? Then
> CherryPy 2.1 is still a great option for you with Apache:
> http://www.cherrypy.org/wiki/WSGIServers
> http://www.cherrypy.org/wiki/BehindApache

According to the "quick facts" page [1] "CherryPy powered web
applications are in fact stand-alone Python applications embedding
their own multi-threaded web server", suggesting that if the hosting
environment is "limited to Apache" and if this can also be taken to
mean that the environment doesn't permit long-running server processes
apart from Apache, then CherryPy isn't likely to be suitable.

Karigell was also mentioned, but according to the documentation
("Working with Apache or Xitami" [2]) "Apache will be used as a proxy
between the client and the built-in server, so you have to configure
Apache so that it sends the requests to the built-in server", also
suggesting that in limited hosting environments Karigell won't be
suitable either.

Spyce, on the other hand, seems to work with mod_python, although I
agree with Andrew Clover that the inquirer probably knows what they
want to do using a "traditional" Web application programming style and
doesn't need a framework which decides lots of things on their behalf.
Moreover, I'd imagine that not all restrictive hosting environments
make mod_python available to their clients.

My meagre contribution to the genre is WebStack [3] which does run in
the most plain of hosting environments (CGI) as well as others. Really
intended for the writing of frameworks, the programming style might
suit someone who wants to have control over the most elementary
aspects of Web programming. As Andrew said, there are plenty of
choices...

Paul

[1] http://www.cherrypy.org/wiki/CherryPyQuickFacts
[2] http://karrigell.sourceforge.net/en/apache.htm
[3] http://www.python.org/pypi/WebStack
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-10 Thread Jorey Bump
Daniel Bickett <[EMAIL PROTECTED]> wrote in 
news:[EMAIL PROTECTED]:

> I neglected to mention an important fact, and that is the fact that I
> am limited to Apache, which elminates several suggestions (that are
> appreciated none-the-less).

"Limited to Apache" is not the same as "using apache in a restricted 
environment", so we may need more clarification.

If you are looking for a solution that sits on top of apache somehow, and 
you have system administrative access, there are a lot of choices, 
including ones that use mod_python. If something is not intended to 
interface directly with apache, it can still be proxied through apache 
while it runs on an alternate local port (a standalone app with an 
embedded web server, for example).

If you mean that you're in a typical hosted environment with insufficient 
privileges to install or configure much of anything, you might be stuck 
with CGI. Since you mention in your original post that you have a folder 
in your home directory that's in sys.path, your provider is trying to do 
something to support python applications (hopefully, the path is specific 
to your virtual host, to avoid namespace collisions). In any case, if 
this was done to support mod_python, you can meet some of your criteria 
with mod_python.publisher, but you will almost certainly want to use a 
staging platform to develop your apps beforehand, since it is necessary 
to either restart apache or touch imported modules after editing.

BTW, this is how I use Python for web applications myself: Each virtual 
host gets a special directory prepended to the PYTHONPATH, in which the 
bulk of my applications are created as packages. Then I use 
mod_python.publisher to publish single modules that serve as interfaces, 
converting values from requests and passing them on to the packages, 
which I try to make web agnostic (in fact, I develop most of the backend 
code locally before even trying it out on the web, so I can use it in 
other application domains). 

I've looked at other offerings, but as soon as I see proprietary markup 
or commands embedded in HTML, I lose interest, so I feel your pain.

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Yet Another Python Web Programming Question

2005-07-09 Thread Robert Brewer
Daniel Bickett wrote:
> I neglected to mention an important fact, and that is the fact that I
> am limited to Apache, which elminates several suggestions (that are
> appreciated none-the-less).

Do you have access to mod_python, mod_rewrite, FastCGI, or SCGI? Then
CherryPy 2.1 is still a great option for you with Apache:
http://www.cherrypy.org/wiki/WSGIServers
http://www.cherrypy.org/wiki/BehindApache


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread Daniel Bickett
I neglected to mention an important fact, and that is the fact that I
am limited to Apache, which elminates several suggestions (that are
appreciated none-the-less).
-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread and-google
Daniel Bickett wrote:

> Python using CGI, for example, was enough for him until he started
> getting 500 errors that he wasn't sure how to fix.

Every time you mention web applications on this list, there will
necessarily be a flood of My Favourite Framework Is X posts.

But you* sound like you don't want a framework to take over the
architecture of your app and tell you what to do. And, indeed, you
don't need to do that. There are plenty of standalone modules you can
use - even ones that are masquerading as part of a framework.

I personally use my own input-stage and templating modules, along with
many others, over standard CGI, and only bother moving to a faster
server interface which can support DB connection pooling (such as
mod_python) if it's actually necessary - which is, surprisingly, not
that often. Hopefully if WSGI catches on we will have a better
interface available as standard in the future.

Not quite sure what 500 Errors you're getting, but usually 500s are
caused by unhandled exceptions, which Apache doesn't display the
traceback from (for security reasons). Bang the cgitb module in there
and you should be able to diagnose problems more easily.

> He is also interested in some opinions on the best/most carefree way
> of interfacing with MySQL databases.

MySQLdb works fine for me:

  http://sourceforge.net/projects/mysql-python/

(* - er, I mean, Hypothetical. But Hypothetical is a girl's name!)

-- 
Andrew Clover
mailto:[EMAIL PROTECTED]
http://www.doxdesk.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread Luis M. Gonzalez
Try Karrigell ( http://karrigell.sourceforge.net ).
And let me know what you think...

Cheers,
Luis

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread Jonathan Ellis
Daniel Bickett wrote:
> He would read the documentation of Nevow, Zope, and Quixote, and would
> find none of them to his liking because:
>
> * They had a learning curve, and he was not at all interested, being
> eager to fulfill his new idea for the web app. It was his opinion that
> web programming should feel no different from desktop programming.

If you're coming from a PHP background, you'll find Spyce's learning
curve even shallower.

http://spyce.sourceforge.net

-Jonathan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread Dave Brueck
Daniel Bickett wrote:
> He would read the documentation of Nevow, Zope, and Quixote, and would
> find none of them to his liking because:
> 
> * They had a learning curve, and he was not at all interested, being
> eager to fulfill his new idea for the web app. It was his opinion that
> web programming should feel no different from desktop programming.
> 
> * They required installation (as opposed to, simply, the placement of
> modules), whereas the only pythonic freedom he had on his hosting was
> a folder in his /home/ dir that was in the python system path.

I've been playing with CherryPy lately, and it's been a lot of fun (for me, it 
meets both the above requirements - obviously anything will have a learning 
curve, but CherryPy's is very small).

-Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yet Another Python Web Programming Question

2005-07-09 Thread Devan L
Take some time to learn one of the web frameworks. If your host doesn't
already have it, ask your host if they would consider adding it.

-- 
http://mail.python.org/mailman/listinfo/python-list