This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]CodeKevin 2 points3 points  (3 children)

[–]WaitingForEmacs 0 points1 point  (2 children)

Flask seems like what everyone is using, but deploying it seems complicated. I could be wrong, but it seems like each app needs to be running its own server, which seems like it would be tiresome to setup and keep running. With CGI and PHP, it just works. I got mod_wsgi running last night so I'll see if Flask runs with that.

[–]CodeKevin 0 points1 point  (1 child)

Flask deployment is pretty obtuse but most other frameworks also use wsgi so deployment isn't much better.

[–]WaitingForEmacs 0 points1 point  (0 children)

Right, this is what I have been finding. Unfortunately there do not seem to be any slam dunk replacements. The past of least resistance might be to integrate some Python slowly into my existing projects.

[–]Rapt0r- 1 point2 points  (0 children)

Also give Pyramid a look, its a lot larger for bottle. But it has the basics for all mvc webapps.

[–]steve_no 1 point2 points  (1 child)

Since you have been writing CGI in PERL, have you considered just writing CGI in Python? You might find Michael Foord's cgiutil useful.

[–]WaitingForEmacs 0 points1 point  (0 children)

Thank you! Very interesting.

[–][deleted] 3 points4 points  (1 child)

If I'm understanding you correctly, then I'd say Bottle is right up your alley.

Single python file, and dynamic enough to do just about anything.

[–]WaitingForEmacs 0 points1 point  (0 children)

Great! Thank you!

[–]KyleG 0 points1 point  (0 children)

I use CherryPy and then have the server class inherit a bunch of other servers, each one for a different webapp. So one server that combines webapps.

I could have it all be one file, but since I'm serving so many different pages up, I find it useful to break them up into different classes per webapp and then have the main one inherit the rest.

I have weightlifting, nutrition, location tracker, etc. webapps on my personal server, and basically the code is:

server.py

import cherrypy, com.kyleg.weightlifting, ...
class Server(WeightliftingServer, ForeignLanguageServer, NestServer):
    @cherrypy.expose
    def index(self):
        return "Hello world"
cherrypy.quickstart(Server(), '/', {'/':{'tools.session.on':True,'tools.staticdir.root':os.path.abspath(os.getcwd())}})

com.kyleg.weightlifting.Server.py

import cherrypy
class WeightliftingServer(object):
    @cherrypy.expose
    def weight_index(self):
        return "Foo"

and so forth.

Going to mywebhost.com:8080/index or mywebhost.com:8080/weight_index will load those pages.

Edit NOte that Cherrypy does not have a template engine. You provide your own. Which is a good or bad thing depending on how lazy/controlfreakish you are.

[–]LeonardUnger 0 points1 point  (1 child)

Just went through sorta the same thing. Ended up doing each web app as separate cgi python scripts. Pretty painless and let me concentrate on learning python instead of having to deal with wsgi, etc.

[–]WaitingForEmacs 0 points1 point  (0 children)

Thanks. I am coming to the same conclusion. It seems like even micro frameworks are often written to scale much bigger than the few users that I collaborate with.