9 ms·
Must-have Django packages
- porter 13y agoWhat about South?
- collyw 13y agoI currently use Tasypie. Would I gain anything switching to Django REST framework?
- edanm 13y agoWe switched form Tastypie over to Django REST Framework, and are overall pretty happy. Cleaner, clearer code that's easier to work with. Plus, it generates a browsable api that you can explore via the web, without any extra work. Which makes life a lot easier, believe me.
- natmaster 13y agoThe APIs are more sane. Added bonus of a cool HTML api explorer view.
- waterlion 13y agoHow do you square that with the article? It specifically says that that Django REST is "insane".
- dkoch 13y agoDon't be a pedant. The author uses the word in the sense of the slang expression "insanely great."
- waterlion 13y agoDon't be a joke pedant? The author (me) uses the quotation in an ironic manner.
- natmaster 13y agoThe word insane does not appear on the page
- gojomo 13y agoIt previously appeared, with regard to DRF, where the word 'excellent' does now.
- SEJeff 13y agoBonus points that Daniel Lindsay (tastypie author) got a job with Amazon, works on boto, and does very little with tastypie anymore. D-R-F is actively maintained and is a bit nicer to work with. Also, the autogenerated apiview "self documenting api" is super duper nice.
- antihero 13y agoAlso, the DRF author, Tom, actively attends meetup and does talks here in Brighton.
- michaelmior 13y ago"Must-have" anything always feels like clickbait to me.
- polpetta 13y agoEh, Internet is based on clickbaits and lolcats. $ad but true.
- cheshire137 13y agoJust reminds me of scummy in-your-face ads everywhere, like at a mall or in a women's magazine.
- falcolas 13y agoInteresting, my fairly large django project uses none of those. Instead, the addons we consider to be critical are these these: django-debreach django-redis jinja2 pytz Redis for queues and caching, debreach to secure the CSRF tokens and vary your content length to avoid the BREACH vulnerability. jinja2 for doing templates outside of returning data, and pytz so you can use timezones in your data models. I also recommend installing `flup` and running via fastcgi, but that's open to interpretation.
- belluchan 13y agoDoes django-redis block? I'm not sure I'd make a connection from django to anything other than a low latency queue.
- conesus 13y agoI think Redis fits your definition of low latency queue. It does in my book, and I run a few thousand concurrent connections to Redis from Django. I also endorse django-redis and use it for caching, pub sub, and various data types. See https://github.com/samuelclay/NewsBlur/blob/master/settings.py#L584-L597 https://github.com/samuelclay/NewsBlur/blob/master/settings.... for my redis configuration. I also use django-redis for caching (which is higher up in that file).
- falcolas 13y agoYes, but then again so do the underlying mysql connections. It does use native python sockets, so gevent.monkeypatch would probably work. Blocking is one of the reasons I use flup and fastcgi - it doesn't matter if one thread of execution blocks; it won't affect any other requests. I've tested this under load with some really gnarly queries, and it works fantastically.
- oinksoft 13y agopytz probably doesn't belong in a discussion of Django libraries. It's needed by pretty much any Python program that works with localized datetimes. > jinja2 for doing templates outside of returning data What do you mean?
- dkoch 13y agoI've found django-allauth a bit friendlier than django-social-auth, and it covers registration of local accounts in one package.
- plumeria 13y agoYep, an interesting comparison is found here: https://speakerdeck.com/tedtieken/signing-up-and-signing-in-users-in-django-with-django-allauth https://speakerdeck.com/tedtieken/signing-up-and-signing-in-...
- bmelton 13y agoOddly enough, django-social-auth has been deprecated for some time now in favor of python-social-auth[1] (same author). It is more user friendly than django-social-auth, and also offers up a lot more functionality that django-social-auth wasn't giving me. [1] - https://github.com/omab/python-social-auth https://github.com/omab/python-social-auth
- thatthatis 13y agohttps://github.com/omab/psa-allauth https://github.com/omab/psa-allauth looks like it might have the best of both worlds.
- waterlion 13y ago"Django REST framework is an insane framework" I'm fed up with this kind of oppressive language. This is heteronormative and is discriminatory to the mentally ill. It's stuff like this that leads to the imbalance and under-representation in the industry. Let's boycott this author. (I would love not to have to write "</satire>" but having seen some of the comments here, I think I need to. I wonder how many white-knights-for-women use language like this without thinking. We need some flexibility in the way people are allowed to express themselves.)
- epochwolf 13y agoHow is this heteronormative? I didn't see any reference to gender in the entire article. Also, you're really stretching the "discrimination to the mentally ill" thing to the point of silliness.
- robertfw 13y agoshould have used a bigger </satire>...
- epochwolf 13y agoOr perhaps waterlion should have just not made the joke. It does not relate to the article in any fashion I can find relevant nor does it add anything to the existing discussion.
- waterlion 13y agoI think it adds to the broader discussion that goes on on HN, specifically over the last month or so. Could you remove that joke about the dog from your profile page please? I went there looking for serious information.
- epochwolf 13y agoIf you could tell me what you're looking for instead of what you're not looking for, I'd be happy to provide it.
- TheMakeA 13y agoWhat are people using these days for compiling their static assets (js minification + concatenation, etc)? We have been using django-pipeline but it has been a nightmare.
- rule30 13y agoThis is a brilliant question, any package about that?
- papercruncher 13y agoWe switched to the google pagespeed module for nginx and stop worrying about it. It doesn't do minification very well but it does concatenation and takes care of a bunch of other stuff as well, like image resizing, CSS concatenation etc. We used to use the HTML5 Boilerplate script but it was horrendously slow on EC2
- tdj 13y agoI'm pretty happy with django-compressor.
- bigsassy 13y agoMe too.
- conesus 13y agoI use Jammit for static asset compression. (from https://medium.com/cs-math/f29f6080c131 https://medium.com/cs-math/f29f6080c131) Jammit came out of DocumentCloud, and even though it was built for Ruby on Rails you can do something like this and use it for Django pretty easily. One of the things I like about it is you can setup different named configurations for javascript and css for different sections of your site (dashboard, non-authenticated, standard). It supports lots of other stuff too. This is how I use Jammit on NewsBlur: https://github.com/samuelclay/NewsBlur/blob/master/utils/jammit.py https://github.com/samuelclay/NewsBlur/blob/master/utils/jam.... I then compress the assets, upload to S3, and then deploy to my servers. See https://github.com/samuelclay/NewsBlur/blob/master/fabfile.py#L1267-L1284 https://github.com/samuelclay/NewsBlur/blob/master/fabfile.p.... Each app server then downloads from S3. So I can package 2MB of static assets and deploy to to a hundred servers in 10 seconds.
- belluchan 13y agoDjango guardian's performance is ridiculously bad. Better roll your own. We're using it and stuck with it at this point, but some of our page loads have thousands of queries because of all the permission lookups. Permissions probably need to be cached in memory.
- sdfjkl 13y agoAmusingly, my must-have Django packages are mostly things that replace large chunks of Django (Jinja2 for templates, a DB connector/ORM for whatever database the project needs, which even for PostgreSQL is often plain SQLAlchemy). I guess I'll just use flask.py or something for my next project. This is not meant as criticism, just my personal experience.
- mixmastamyk 13y agoYep, having everything built-in is a double-edge sword. I myself love Django, though I find some parts of it a bit over-engineered (in the Java style). That is changing for the better in recent releases though. I'm thinking the render_to_response stuff and management commands, etc.
- JensRantil 13y agoHave a look at Pyramid[1] if you plan a slightly larger project. I've been looking at it for years. [1] http://www.pylonsproject.org/ http://www.pylonsproject.org/
- mixmastamyk 13y agoEveryone recommends the django-toolbar for spotting slowdowns in your SQL... ok, installed it. I almost never see any tips on how to actually do that though. What now? (I suppose the SQL part of my app is not the problem though, rather the number crunching that happens on the data returned. I do lots of caching on the results instead to make the site seem responsive.)
- true_religion 13y agoIf you're doing a lot of # crunching, you might try using Cython for those bits. You can get a 10x speedup without changing semantics and just annotating types.
- mixmastamyk 13y agoThanks for the tip. Most of it is done by python-dateutil though so I think it in C already. I'm basically checking ~500 recurring events to see if they occur today with django-schedule.
- aidos 13y agoOooow. Interesting one. So the events can be on different schedules / frequencies? It sounds like something you should be able to do with a single sql query. Could you provide a bit more info?
- mixmastamyk 13y agoHmm, currently it uses python-dateutil to find recurring dates. I chose django-schedule at the time as it seemed the best choice, which is built upon it. I'm not certain postgres for example has that kind of functionality around dates. Googling, I found this though: http://justatheory.com/computers/databases/postgresql/recurring_events.html Looks promising. Rewriting the core of the app is a pretty big project though, it's just a side-project so I'm not sure I'll get that amount of time.
- bonemachine 13y agoWow, man. That's a lot of boilerplate.
- famousactress 13y agoNotable omission of South ( http://south.aeracode.org/ http://south.aeracode.org/ )
- japhyr 13y agoI think that's because South has been rolled into Django now. Is that correct?
- route3 13y agoSoon! Migrations[0] are being included in Django 1.7 which is currently under development. For those unaware, Andrew Godwin, the author of South, ran a successful Kickstarter campaign[1] the fund this effort to incorporate migrations in Django core. [0] https://docs.djangoproject.com/en/dev/topics/migrations/ https://docs.djangoproject.com/en/dev/topics/migrations/ [1] http://www.kickstarter.com/projects/andrewgodwin/schema-migrations-for-django http://www.kickstarter.com/projects/andrewgodwin/schema-migr...
- huxley 13y agoClose, but not exactly, Andrew Godwin, the creator of South, has added support for migrations into the dev branch of Django, to be part of the Django 1.7 release. https://docs.djangoproject.com/en/dev/topics/migrations/ https://docs.djangoproject.com/en/dev/topics/migrations/ Andrew has significantly rethought migrations and applied the lessons he's learned from years of maintaining and developing South. He's kept a developer diary that has been pretty fascinating to read (YMMV): http://www.aeracode.org/2013/11/27/new-apps-migrations/ http://www.aeracode.org/2013/11/27/new-apps-migrations/ and others at: http://www.aeracode.org/category/django-diaries/ http://www.aeracode.org/category/django-diaries/ [update: route3 is faster than me, but still it's worth checking out the developer diaries]
- ericd 13y agoFor a greenfield app, would you recommend starting with 1.7, or do you think it will be simple enough to convert from South that it's not worth it? (I have no idea how stable 1.7 is)
- reinhardt 13y agoI've been away from the Django ecosystem for the last few years.. how is Pinax doing these days?
- mixmastamyk 13y agoSeems dead, a shame because I wouldn't mind a more complete starting point when creating a project.
- glynjackson 13y agoA few I work with on most projects are... Backend: one of the most popular API Frameworks is Tastypie. Authentication and authorization: Django Userena. Debugging: Django Extensions. Django CMS Django Haystack These are a must for your tool kit.
- timc3 13y agoI would recommend DjangoRestFramework any day over Tastypie after having used Tastypie for two years. DjangoRestFramework code base is better, it's better thought out, it should be part of Django core.
- glynjackson 13y agoI've used both in projects I honestly don't like the auto documentation Django Rest Framework assumes you want. I enjoyed using both but I lead towards TastyPie, yum!
- aikii 13y agoCripsy forms, because simple things like adding the necessary markup for bootstrap to forms is super-boring otherwise ; in general, it helps with custom form layout, which is usually a template maintenance hell https://github.com/maraujop/django-crispy-forms https://github.com/maraujop/django-crispy-forms
- qoo 13y agodjango-concurrency django-devserver gargoyle ipdb ipython