

Must-have Django packages - rule30
https://devcharm.com/pages/79-must-have-django-packages

======
falcolas
Interesting, 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
Does django-redis block? I'm not sure I'd make a connection from django to
anything other than a low latency queue.

~~~
conesus
I 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....](https://github.com/samuelclay/NewsBlur/blob/master/settings.py#L584-L597)
for my redis configuration. I also use django-redis for caching (which is
higher up in that file).

------
sdfjkl
Amusingly, 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
Yep, 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.

------
belluchan
Django 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.

------
famousactress
Notable omission of South (
[http://south.aeracode.org/](http://south.aeracode.org/) )

~~~
japhyr
I think that's because South has been rolled into Django now. Is that correct?

~~~
huxley
Close, 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
For 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)

~~~
huxley
Andrew has said in the past that his intent is to provide a migration path
from classic South to "South 2.0" which will backport migrations to earlier
versions of Django (versions 1.4-1.6, I believe) and also build on top of the
migration infrastructure in Django 1.7.

You should be fine sticking with South for now.

~~~
ericd
Cool, thanks very much to you and the other commenter.

------
michaelmior
"Must-have" anything always feels like clickbait to me.

~~~
polpetta
Eh, Internet is based on clickbaits and lolcats. $ad but true.

------
aikii
Cripsy 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)

------
dkoch
I've found django-allauth a bit friendlier than django-social-auth, and it
covers registration of local accounts in one package.

~~~
plumeria
Yep, an interesting comparison is found here:
[https://speakerdeck.com/tedtieken/signing-up-and-signing-
in-...](https://speakerdeck.com/tedtieken/signing-up-and-signing-in-users-in-
django-with-django-allauth)

------
mixmastamyk
Everyone 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
If 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
Thanks 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
Oooow. 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
Hmm, 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.

~~~
aidos
Just thinking that maybe you had a single core lookup that you needed to
optimise. A slow running "find all events that repeat on today." If it's
something that's more deeply scattered through the system then it might not be
worth attacking.

If you just needed the events for today you should be able to do something
simpler. Depends on the complexity of the frequency controls. But imagine
weekly recurring - you should be able to do something like _" (today - start
day) mod 7 == 0"_ to find all weekly events that hit today. You could then
construct a similar rule for each different frequency:

    
    
        -- not real code!
        select * from event where
        (frequency = 'daily')
        or (frequency = 'weekly' and (today - starts) % 7 == 0)
        or (frequency = 'monthly' and day(today) == day(starts))
        or (frequency = ...)
    
    

Just a thought.

------
reinhardt
I've been away from the Django ecosystem for the last few years.. how is Pinax
doing these days?

~~~
mixmastamyk
Seems dead, a shame because I wouldn't mind a more complete starting point
when creating a project.

------
TheMakeA
What 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.

~~~
peter_l_downs
We're currently using Django Compressor [0], and it works pretty well. It was
slightly annoying to get it to work well with staticfiles [1], as we host all
of our content on S3 and serve through cloudfront in production. But, it's
nice because now we can do this in our template:

    
    
        <script src="{% static js/mylib.js %}"></script>
    

and with compress like this:

    
    
        {% compress js %}
          <script src="{% static js/mylib.js %}"></script>
        {% endcompress %}
    

so that referencing static files is consistent.

[0]:
[https://github.com/jezdez/django_compressor](https://github.com/jezdez/django_compressor)

[1]:
[https://docs.djangoproject.com/en/dev/ref/contrib/staticfile...](https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#module-
django.contrib.staticfiles)

~~~
michaelmior
I used to use this, and it is convenient for small sites. But it quickly gets
hard to manage. It also makes it extremely difficult to share compiled assets
between pages with different templates.

------
porter
What about South?

~~~
gmu3
I agree South should probably make the list although database migrations have
finally made their way into the Django core so perhaps that's why the author
didn't mention South.

------
glynjackson
A 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
I 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
I'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!

------
collyw
I currently use Tasypie.

Would I gain anything switching to Django REST framework?

~~~
SEJeff
Bonus 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
Also, the DRF author, Tom, actively attends meetup and does talks here in
Brighton.

------
bonemachine
Wow, man. That's a lot of boilerplate.

------
waterlion
"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
How 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
should have used a bigger </satire>...

~~~
epochwolf
Or 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
I 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
If you could tell me what you're looking for instead of what you're not
looking for, I'd be happy to provide it.

~~~
waterlion
I'm looking for interesting discussion with intelligent people on a range of
subjects guided by user-submitted stories. I'm looking for explorations of
ideas, learning new things, synthesis as well as derivative ideas. Open-
mindedness and acceptance. Otherwise there's no point.

I'm not looking for pedantry and closed-mindedness (I'm not accusing you of
those things).

I'm probably in the wrong place for that on HN, but the articles are
interesting and often so is the discussion.

~~~
epochwolf
That's an odd thing to look for on my profile page.

~~~
waterlion
I'm going to give you the benefit of the doubt that I would want others to
extend to me and not accuse you of pedantry. But I don't think there's much
steam left in this conversation.

