Lowest hassle Python web server?

K

kanzen

I keep telling my friends that Python rocks. Now it's time to put my
money where my mouth is. I'm about to start writing a server for a
phone based game. It needs to handle simlpe requests from some Java
code running on the phone at a fairly low transaction rate. There will
also be a simple web site allowing users to edit preferences and so
forth. I have just enough Python experience to decide that I prefer it
over Java for this job. It'll be on a Linux box that I have full
control over.

I can see from FAQs that there are several possible ways of doing web
server work in Python, e.g. Twisted or mod_python in Apache, etc. So
I'm wondering:

- Could you recommend a solution you've found to be the most
convenient?
- Does threading cause any more of a hassle in Python than Java?
- Is there anything similar to JSP in Java?

Thanks,
KanZen
 
P

Peter Hansen

kanzen said:
- Does threading cause any more of a hassle in Python than Java?

What hassles have you had? I thought threads in Java
were pretty straightforward. In any case, in Python
they are generally very easy to use, provided you have
a basic knowledge of thread safety issues and/or provided
you restrict all interaction between threads to use
the Queue module.
- Is there anything similar to JSP in Java?

Snakelets? Google will find it for you.

-Peter
 
A

Adonis

kanzen said:
I keep telling my friends that Python rocks. Now it's time to put my
money where my mouth is. I'm about to start writing a server for a
phone based game. It needs to handle simlpe requests from some Java
code running on the phone at a fairly low transaction rate. There will
also be a simple web site allowing users to edit preferences and so
forth. I have just enough Python experience to decide that I prefer it
over Java for this job. It'll be on a Linux box that I have full
control over.

I can see from FAQs that there are several possible ways of doing web
server work in Python, e.g. Twisted or mod_python in Apache, etc. So
I'm wondering:

- Could you recommend a solution you've found to be the most
convenient?
- Does threading cause any more of a hassle in Python than Java?
- Is there anything similar to JSP in Java?

Thanks,
KanZen

You can look into CherryPy http://www.cherrypy.org/

Hope this helps
Adonis
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

kanzen said:
I keep telling my friends that Python rocks. Now it's time to put my
money where my mouth is. I'm about to start writing a server for a
phone based game. It needs to handle simlpe requests from some Java
code running on the phone at a fairly low transaction rate. There will
also be a simple web site allowing users to edit preferences and so
forth. I have just enough Python experience to decide that I prefer it
over Java for this job. It'll be on a Linux box that I have full
control over.

I can see from FAQs that there are several possible ways of doing web
server work in Python, e.g. Twisted or mod_python in Apache, etc. So
I'm wondering:

- Could you recommend a solution you've found to be the most
convenient?

I've tested a few, and when it finally came that I wanted and needed to
do web application development in Python for real, I decided to use
Snakelets.

So far, I find it a very convenient way to write web applications. It's
also very close to how Java servlets/JSP pages work.

FWIW, the other frameworks I've tested thoroughly were Quixote and WebWare.
- Does threading cause any more of a hassle in Python than Java?
- Is there anything similar to JSP in Java?

Snakelets Ypages come close to JSP.

-- Gerhard
 
N

Neil Benn

- Does threading cause any more of a hassle in Python than Java?
<snip>
Hello,

From the python docs, it states that the threading design is loosely
based upon the java module. Certainly, coming from Java I had little
trouble getting used to python threading. However heres some gotchyas :

- The thing to beware of there is something in Python called the GIL.
Read up about that before you start threading stuff - this will explain
to you why there is no volatile keyword - this got me confused at first.
- There is no synchronize keyword, instead you have to use locks which
can be obtained from the threading module
- There are no methods such as wait on an object (there is an event
object you can get to call wait upon - again threading)
- The handy concurrent stuff which has been introduced in J2SE5.0
mainly isn't in python - through you do get Queues in Python (maybe
more, I dunno?)

The GIL thing makes it easier to do threading with Python (there are
disadvantages to the GIL but I won't get into that here - if you're
interested read through the history on this group) but it's still
threading so beware!

Cheers,

Neil

--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : (e-mail address removed)
Cenix Website : http://www.cenix-bioscience.com
 
K

kanzen

Okay, thanks for your suggestions. Are there any further
recommendations as to what Python framework to use if the web server is
Apache with mod_python?
 
L

Larry Bates

kanzen said:
I keep telling my friends that Python rocks. Now it's time to put my
money where my mouth is. I'm about to start writing a server for a
phone based game. It needs to handle simlpe requests from some Java
code running on the phone at a fairly low transaction rate. There will
also be a simple web site allowing users to edit preferences and so
forth. I have just enough Python experience to decide that I prefer it
over Java for this job. It'll be on a Linux box that I have full
control over.

I can see from FAQs that there are several possible ways of doing web
server work in Python, e.g. Twisted or mod_python in Apache, etc. So
I'm wondering:

- Could you recommend a solution you've found to be the most
convenient?
- Does threading cause any more of a hassle in Python than Java?
- Is there anything similar to JSP in Java?

Thanks,
KanZen
You might want to take a look a Medusa. It is the basis for the
web server that is bundled in Zope.

http://www.nightmare.com/medusa/

Larry Bates
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Larry said:
[...] You might want to take a look a Medusa. It is the basis for the
web server that is bundled in Zope.

Medusa is just an asyncore framework, and not something you can develop
web apps with.

-- Gerhard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top