tags:

views:

115

answers:

2

I'm working on a django website that needs to track popularity of items within a given date/time range. I'll need the ability to have a most viewed today, this week, all time, etc...

There is a "django-popularity" app on github that looks promising but only works with mysql (I'm using postgresql).

My initial thoughts are to create a generic ViewCounter model that logs views for all the objects that are tracked and then run a cron that crunches those numbers into the relevant time-based statistics for each item.

Looking forward to hearing your ideas.

A: 

Did you try django-popularity with postgres? The github page just says that the developer has not tested it with anything other than MySQL.

Andrew Austin
No it doesn't work with posgresql.
Mark
A: 

The app has only been tested with MySQL but it should fully work for Postgres with few adjustments. If you do manage to get it to work: please inforrm me. (I'm the developer.) I would love to be able to tell people this product is useable for Postgres as well.

Moreover; all the funcitonality relying on raw SQL checks whether there is actually a MySQL database in use. If not, it should throw an assertion error.

Also, the generic viewcounter is already in my package (it's called ViewTracker, but hell). The cron job seems too much of a hassle to me if we could do either SQL or Django caching as well.

Mathijs
Yeah, I agree. Caching would be a much better approach than cron. I really like how your app is designed however I'm not sure it supports the exact scenario I need. I'm looking for a way to track "most popular today", "most popular this week" etc... I may be mistaken but I'm not sure django-popularity supports this?
Mark
No, it doesn't.
Mathijs