2

I am currently developing an iOS application that needs a backend to pull data from. I have implemented the backend using Python, web.py and pymongo.

I deployed everything on an EC2 instance, assigned an elastic IP to the instance that the iOS devices call to access the backend, and launch the application through SSH by doing:

nohup python main.py &

Everything works fine (couple dozen users a day, with potential to grow; data transferred is rarely more than a few kilobytes), but I'm wondering if this is the proper way to do things.

For instance on the web.py website, they explain ways to use web.py with Apache, lightppd etc.; are these just special cases, or should I be deploying my backend using one of those full featured servers?

bitgarden
  • 10,461
  • 3
  • 18
  • 25

2 Answers2

2

FWIW, we use CherryPy (the web server "built into" web.py) behind nginx to serve most of the HTML at Oyster.com -- nginx splits the traffic across 2 or 3 web servers each running 4 Python processes, and we can easily handle 100s of requests per second.

However, we use a content delivery network (CDN) for our static resources like images and CSS.

Ben Hoyt
  • 10,694
  • 5
  • 60
  • 84
1

I would absolutely use a full web server rather than the one built into web.py, although you should be okay for now if the traffic remains low. I think the one built into web.py is supposed to be used for debugging, rather than production.

It's mostly a matter of preference which of those servers you use, but I like Nginx with uWSGI.

icktoofay
  • 126,289
  • 21
  • 250
  • 231
  • Actually, CherryPy, the web server "built into" web.py, is quite a fast web server. We use this behind nginx for a high-traffic website -- see also my answer. – Ben Hoyt Oct 21 '11 at 18:30
  • 1
    @benhoyt: It looks like you're right; I hadn't realized web.py used CherryPy. (I had thought it used [`BaseHTTPServer`](http://docs.python.org/library/basehttpserver.html)) Upvote to you. – icktoofay Oct 22 '11 at 03:34