Ask anything about python



for little apps, simple routers like circuits.web, bottle.py and cherry.py are great, but as soon as you add in the database layer, there's usually no reason not to use ORM. most python ORM libraries can be setup and configured with a single table in less than 10 lines (for example, a single 5 column db table). most web frameworks will allow you to snap in any ORM you want, but i've always enjoyed using framework+ORM bundles.

this leaves two main contenders, in my mind -- turbogears (old, underdeveloped, i've never used it) and pylons/django. i group pylons/django because they're structurally very similar; the main difference being their default setup. on that note, pylons follows a philosophy of "choose anything you want" and django follows a philosophy of "there, i did that for you, change it if you're unhappy". for example django, by default, is configured to use djangoORM (you can swap out for SQLAlchemy) and pylons is not configured to use anything by default (but SQLAlchemy snaps in real easy).

all that being said, django's contrib package (specifically django.contrib.admin) is so damn good, i draw wood over it. for even my smallest projects, i usually immediately start a new django app, enable the admin, and start defining my models. then, i've already got my db tables setup, user authentication enabled and functional, and a fully customizable /admin/ interface to navigate to, with virtually no code written at all.
 
... are you saying that an entire web framework stack fails because you didn't see the "db_index=true" parameter?

fail, indeed.

pwned111za6.jpg
 
What do you recommend cURL or urllib2? I have been using urllib2 and with a bit of digging it can do pretty much everything curl can do but I find its easier to make threaded apps with, saying that I have never used Curl multi, also the documentation for pycurl is a little screwy. input?
 
A month ago, I would've said cURL over urllib2 hands-down, but every time mattseh's asked me a question about how to do __X_Y_Z__ in urllib2 and I've replied "I dunno, use cURL instead", he's always immediately found his solution. So, use whatever you want, and if you're using cURL, ask me, and if you're using urllib2, ask mattseh :)

edit -- you're right, pycurl documentation totally sucks, but this wasn't an issue for me as i've been using curl for years in other languages; in retrospect, if urllib2 can do everything pycurl can [and barring any performance differences], might as well use the more-pythonic solution

EDIT 2 -- got gutterseo and mattseh mixed up in my contacts list; turns out i don't even know who's been asking me which questions. sorry guys :-p
 
EDIT 2 -- got gutterseo and mattseh mixed up in my contacts list; turns out i don't even know who's been asking me which questions. sorry guys :-p

That would be me asking the two of you those questions:xmas-smiley-010: