By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,095 Members | 1,586 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,095 IT Pros & Developers. It's quick & easy.

Lowest hassle Python web server?

P: n/a
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

Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
kanzen wrote:
- 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
Jul 18 '05 #2

P: n/a
kanzen wrote:
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
Jul 18 '05 #3

P: n/a
kanzen wrote:
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
Jul 18 '05 #4

P: n/a
<snip>
- 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 : be**@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com

Jul 18 '05 #5

P: n/a
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?

Jul 18 '05 #6

P: n/a
kanzen wrote:
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
Jul 18 '05 #7

P: n/a
Larry Bates wrote:
[...] 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
Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.