473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Yet Another Python Web Programming Question

This post started as an incredibly long winded essay, but halfway
through I decided that was a terribly bad idea, so I've trimmed it
down dramatically, and put it in the third person (for humor's sake).

Once upon a time a boy named Hypothetical programmed in PHP and made
many a web application.

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.

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

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.

* See the first point, over and over again.

All he really wanted was something that managed input (i.e. get, post)
and output (i.e. headers: "Content-type:"), and he would be satisfied,
because he wasn't an extravagant programmer even when he used PHP.

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

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

Thanks for your time,
--
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
Jul 21 '05 #1
8 1297
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.

Jul 21 '05 #2
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

Jul 21 '05 #3
Try Karrigell ( http://karrigell.sourceforge.net ).
And let me know what you think...

Cheers,
Luis

Jul 21 '05 #4
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:an*@doxdesk.com
http://www.doxdesk.com/

Jul 21 '05 #5
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/
Jul 21 '05 #6
Daniel Bickett <db******@gmail.com> wrote in
news:ma***************************************@pyt hon.org:
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.

Jul 21 '05 #7
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
Jul 21 '05 #8
"Daniel Bickett" <db******@gmail.com> wrote in message
news:ma***************************************@pyt hon.org...
<snip>
It was his opinion that
web programming should feel no different from desktop programming.

<snip>

Should that ever become even remotely possible -

I'll be interested in web programming myself.
Thomas Bartkus
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

226
by: Stephen C. Waterbury | last post by:
This seems like it ought to work, according to the description of reduce(), but it doesn't. Is this a bug, or am I missing something? Python 2.3.2 (#1, Oct 20 2003, 01:04:35) on linux2 Type...
0
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to...
68
by: Lad | last post by:
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
20
by: xeys_00 | last post by:
I posted a article earlier pertaining programming for my boss. Now I am gonna ask a question about programming for myself. I just finished my first C++ Class. Next semester is a class on...
25
by: abhinav | last post by:
Hello guys, I am a novice in python.I have to implement a full fledged mail server ..But i am not able to choose the language.Should i go for C(socket API) or python for this project? What are the...
35
by: John Coleman | last post by:
Greetings, I have a rough classification of languages into 2 classes: Zen languages and tool languages. A tool language is a language that is, well, a *tool* for programming a computer. C is the...
16
by: John Salerno | last post by:
Just something that crosses my mind every time I delve into "Learning Python" each night. Does anyone see any value in learning Python when you don't need to for school, work, or any other reason?...
53
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming...
30
by: Ivan Reborin | last post by:
Hello everyone, I was wondering if anyone here has a moment of time to help me with 2 things that have been bugging me. 1. Multi dimensional arrays - how do you load them in python For...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.