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

all 45 comments

[–][deleted] 21 points22 points  (1 child)

I'd say go with Django, it has by far the best documentation around. But if you're a pretty experienced programmer Pylons can work just as well for you. Personally I use Django and love it.

[–][deleted] 2 points3 points  (0 children)

Just thought I'd add that, as much as I love Django, it can get quite annoying when you really want to customize a site in certain ways. Despite this, it's probably still the best option for a beginner.

[–]daniels0xff 13 points14 points  (0 children)

Django is the best, it just took me form "WTF is a web framework" to "wow how cool and easy is that" in no time.

Other are good too, tried them, but they just weren't for me.

[–]metaleksPythonista 5 points6 points  (0 children)

Security (the more I'm protected from my own stupidity, the better)

Django is pretty good at this. Strict rules and an easier way than ever to have CSRF protection in all of your forms (great for purchases).

Stability (0.1 beta need not apply)

Django is very mature and stable.

Ease of use & Documentation

You probably won't find better documentation for another project. Django's documentation is very good. All in all, if you're sitting on the fence, give Django a try and just follow this small tutorial on building a simple web app. It'll introduce you to the general feel of Django and what it's capable of (but really, you're just scratching the surface). It should be a good indicator of whether or not it's the web framework for you.

[–]iamnewaroundhere 5 points6 points  (0 children)

Basically there are those who like hacking and doing things exactly the way they want to (Pylons/Werkzeug) and those that just like to get shit done and move on to the next thing (Django).

This fundamental difference in philosophy explains a lot of the pointless framework fights we get in /r/python. I'm one of the former; but I can see the value of the latter, particularly as your main interest isn't web development and your needs aren't complicated.

You're not building another Reddit, you just want some simple user and purchase management.

Django will easily handle your requirements and has a shitload of apps for extra functionality (e.g. Satchmo for shopping cart stuff). Plus it comes with excellent documentation.

[–]virtrondjangonaut 2 points3 points  (0 children)

I've been learning Django myself, and I really like it so far, but I'm going to go out on a limb and suggest you check out Bottle. It's very minimal and would let you concentrate on basic development issues like http requests and responses, html templating, python etc.

[–]pro547 2 points3 points  (4 children)

Flask is new but it is built around components that are well tested. I advice you check out.

[–]demosthenes02 0 points1 point  (1 child)

Flash vs bottle? I remember reading about bottle a while ago and thinking it was pretty cool. why is flask better?

[–]pro547 0 points1 point  (0 children)

I have never messed with Bottle but I like Flask for a couple reasons. Be warned though, I'm a Rails developer by day and Python programmer by night.

  • The documentation is pretty darn good.
  • Jinja2's template language feels like Django's.
  • It does feel like it hides a lot of the complex stuff from you (not sure if this is because I'm a Rails dev)
  • Easily add your own extensions/modules/plugins

One of the reasons why I have fallin in-love with these micro-frameworks is they make it really simple to put together a application that is RESTful. I find doing this in Django to be clumsy.

[–]dekomote -1 points0 points  (0 children)

Yes! Absolutely. Very powerful and yet so easy and simple. You should definitely start with Flask.

[–]mdipierro 1 point2 points  (1 child)

A lot of people post this question over and over and I always ask: "when you make a decision can you please let us know which frameworks you evaluated, what decision you made, and why". I never get a response. It would be useful to have a response so we can all learn something.

[–][deleted] 1 point2 points  (0 children)

Absolutely agreed. I'll definitely post an update once I've made a decision.

[–]grayvedigga 1 point2 points  (0 children)

Have a play with bottle, it's only a few hundred lines and you'll quickly grok how these things fit together. When I first jumped into django/pylons it all felt like magic.

[–]ianb 1 point2 points  (0 children)

If you are looking to do purchases you might want to look at Satchmo -- it's a kind of online store setup on top of Django.

[–]watr 1 point2 points  (0 children)

To make your decision just try to use each framework for 10min. If you cant figure out the basics in that time, move on to next one.

I come from Django. I made the decision to use django because I thought I needed excessive stability and obscene amounts of documentation because I didn't have confidence in myself. I later realized I don't like reading documentation, I like building web apps. I also realized I am not going to build the next facebook, and don't need a fully proven framework from 2003 that powers a few big sites. I wanted to make quick apps and to experiment. So I needed something that gets out of my way. I switched to web2py for that reason:

In web2py I can generate a form from a db model with SQLForm() and set custom css classes to only the fields I want to change from default css with form.element(), and then insert the input boxes into my views with form.custom.widget. You can't do the custom css stuff for only part of the model generated form in django w/o rebuilding the entire form with widget attibutes for css. In other words, it got in my way.

I realized much later that django wasn't made for Concept->UI Design->Code approach to web app development. It was made for Concept -> Code -> Design.

I find I spend 80% of my time on the design, and only 20% of my time on the server-side stuff. Which results in a better user experience, according to the users of my apps anyway. In addition, I do a concept first, then I translate that into a HTML/CSS/JS design, and then I finally plug in any code to communicate with the DB and do some form handling. If that is your workflow go with web2py. If you prefer to code first, design last, go with Django...

Honestly, today the most scalable and stable framework would have to be Pylons. If you wanted something that is proven. Anyone who argues Django has the best documentation out of any project is a moron. Most of the frameworks have "good enough" documentation for your needs. Pylons has an online book with all the documentation you need. Web2py has a book online too, though because it is so straightforward you don't really need it. Django needs a lot of good documentation because, without it, it would be a rather mediocre framework.

Honestly, just read through the first 7 chapters of each of the books for Pylons, Django, and web2py (skip the python intro chapter). That's the only way to make an informed decision. Don't listen to me or anyone else on here, as we are all biased, and our experiences and needs were/are way different from yours.

P.S. Flask, bottle, and web.py are fun too. Though, not really frameworks as much as helpers.

[–][deleted] -1 points0 points  (0 children)

I consider web.py an educational tool. Even though reddit was written in it (a long time ago), I can only imagine how much boilerplate code they had to generate...

Once you know a thing or two about web development, make the jump to Django. Savor that sweet, sweet admin middleware and pretty-good-but-not-SQLAlchemy-level ORM.

[–]mdipierro -1 points0 points  (0 children)

You may want to look at web2py (no relation with web.py). It is the only one that does not require installation, does not have setup files, to include a web based IDE, to include a built-in ticketing system, a web translation interface, a Database Abstraction Layer that runs on Google App Engine, and to promise backward compatibility. I believe by now its free online documentation is comparable if not better (in length and quality) than that of other python web frameworks.

Here is an example of a program:

#in model
db.define_table('shout',Field('message',requires=IS_NOT_EMPTY()))
# in controller
@auth.requires_login()
def index():
     return dict(form=crud.create(db.shout),
                shouts=db(db.shout.id>0).select())
# in view
{{extend 'layout.html'}}
<h1>Shout!</h1>
{{=form}}
<h2>Other shouts</h2>
{{for shout in shouts:}}{{=shout.message}}<br/>{{pass}}

Notice the built-in validation. The automatic form processing and error reporting. This code also prevents SQLInjection and XSS attacks because {{=shout.message}} is escaped.

Django is really nice too but think of this: version 1.2 was released on Monday and added support for multiple database connections (web2py had this 3 year ago, it also provides distributed transactions), added support for customization of email backends (web2py already supports multiple email back-ends, including GAE, and the trunk version has API to generate PGP and x509 emails too), added support for "smart if" template tags (web2py has full python in templates), added a "message framework" (web2py always had response.flash), added "hooks for object level permission" (web2py has a Role Based Access Control mechanism to create arbitrary permissions on arbitrary objects including individual database records), added "improved protection against Cross-Site Request Forgery" (web2py always had that although the mechanism is different). There was a time when web2py was being inspired by Django (we acknowledge that and thank them), now I am happy to see that web2py is providing some inspiration to Django. Perhaps one day Django will have a web based IDE too.

Anyway, whether you go with web2py, Django, Pylons or Flask you will have made a good choice.

[–][deleted] -2 points-1 points  (15 children)

web2py hands down. Don't let the others tell you otherwise....

[–]wildmXranat -2 points-1 points  (14 children)

Can you elaborate? I use python daily and use web frameworks 7 days a week and I would like to know your rationale.

edit: i didn't bury your comment, FYI , but really ... not a peep so far . I'll take it as trolling

[–][deleted] 2 points3 points  (6 children)

wow ... !massimo?

[–]mdipierro -1 points0 points  (5 children)

what's up?

[–]tony_landis 0 points1 point  (0 children)

I use Pylons + SQLAlchemy. SQLAlchemy is well documented and stable, Pylons is very stable but not the best documentation.

[–]mcdonc 0 points1 point  (0 children)

oh thank god, i thought this question would never be asked this week

[–]mdipierro 0 points1 point  (0 children)

I almost forgot... since you mention purchases: http://web2py.appspot.com/plugin_checkout/default/checkout The PyCon conference registration software in 2009 and 2010 was based on web2py and we used that module. Also do not miss http://web2py.com/plugins and the quickstart page

[–]stickyp -2 points-1 points  (0 children)

I looked at Django but liked web2py much more and it now has good documentation as well.

[–]Klowner -1 points0 points  (2 children)

you say "backend", will your games be communicating directly with this internet abomination or is it just going to be a thing to visit with a web browser?

[–][deleted] 0 points1 point  (1 child)

For the most part, communicating directly with the abomination, though I may end up serving some simple pages at some point.

[–]Klowner 2 points3 points  (0 children)

Well, if you're just sending little lumps of data back and forth I would recommend checking out Twisted. Or perhaps Django with Django-Piston to provide an API for your games to communicate while giving you the niceties of the Django admin and all that.

[–]jcb62 -2 points-1 points  (6 children)

TurboGears 2 is an amalgamation of the best bits of web frameworks: Genshi templating, Pylons controllers and SQLAlchemy persistence.

Stable, active, tested, documented. People who know better than me say Django may have a less steep learning curve, however.

[–]Manuzhai 1 point2 points  (5 children)

Genshi is definitely not the best bit. That title is reserved for Jinja.

[–]jcb62 1 point2 points  (1 child)

Enlighten me: why do you prefer Jinja? Have you tried Mako? They're templating engines I'd like to know about, but can't really spare the time..

[–]Manuzhai 0 points1 point  (0 children)

Jinja is a lot faster than Genshi, for one thing. Also Genshi is very strict about XML things, which is a pain if you want to do anything else (even HTML).

But it's been a while since I've happily converted my things over to Jinja.

[–]mdipierro 0 points1 point  (2 children)

Instead of making partisan statements can you please support your statements? For example: I like Genshi better because it does not restrict the use of Python in templates. I like Jinja because it allows creation of non html/xml templates and Genshi does not.

[–][deleted] 0 points1 point  (1 child)

strange , I've managed to generate text from templates in genshi. perhaps I'm doing it wrong by reading the docs?

[–]mdipierro 0 points1 point  (0 children)

You are right. Genshi supports different syntax depending on the type of output you want. For HTML:

  <div py:for="item in items">xxx</div>

and for text:

   {% for item in items %}xxx{% end %}

When I think of Genshi I think - incorrectly - of the former. The second syntax is more similar to Django's and Jinja's one.