Live data from Hacker News

Must-have Django packages

devcharm.com

81–90 of 100 posts

Re: Must-have Django packages

#81

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.

Why has it been a nightmare? I find it pretty neat. Was using django-compressor earlier but it didn't have support for Python 3.

I'm curious what problems he had with django-pipeline as well. I've been using it for a couple months now and it has been fantastic.

Re: Must-have Django packages

#83
post #77

Earlier quoted context omitted.

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.

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?

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.

Re: Must-have Django packages

#85
post #77

Earlier quoted context omitted.

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?

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…

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.

Re: Must-have Django packages

#86
post #79
post #71

Earlier quoted context omitted.

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/ 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…

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)

1.7 is still in development, but see the expected release schedule[0].

  January 20th: 1.7 alpha  
  March 6th: 1.7 beta  
  May 1st: 1.7 release candidate  
  May 15th: Final release (assuming a second release candidate is not needed)  
[0] http://python.6.x6.nabble.com/1-7-Release-Schedule-td5041311...

Re: Must-have Django packages

#87

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 recomm…

pytz 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?

I assume for things like templating emails. Or configuration files for deployment. That's at least what I've used it for.

It's handier and more straight-forward than using Django's templating engine.

Re: Must-have Django packages

#88
post #79
post #71

Earlier quoted context omitted.

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/ 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…

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)

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.

Re: Must-have Django packages

#89

Earlier quoted context omitted.

pytz 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?

I assume for things like templating emails. Or configuration files for deployment. That's at least what I've used it for. It's handier and more straight-forward than using Django's templating engine.

I thought he might have meant that, but I never had too much difficulty doing this through the Django template API.

Re: Must-have Django packages

#90

Earlier quoted context omitted.

I assume for things like templating emails. Or configuration files for deployment. That's at least what I've used it for. It's handier and more straight-forward than using Django's templating engine.

I thought he might have meant that, but I never had too much difficulty doing this through the Django template API.

It's not bad, but the Jinja2 language is more expressive, and the API is a bit better. Not enough we would migrate away from Django templates to it, but enough to not migrate away from Jinja.
Post reply on HN