tags:

views:

69

answers:

3

I have developed a small django web application. It still runs in the django development web server.

It has been decided that if more than 'n' number of users like the application, it will be approved.

I want to find out all the users who view my application. How can find the user who views my application? Since I was the user who ran the application, all python ways of getting the username returns my name only.

Please help.

+1  A: 

You can look in the admin to see how many usernames are there, assuming everyone who likes it creates one. Or you can look at your server logs and count the unique IPs.

Nathon
+1  A: 

You can keep track of your visitors by adding a call to google analytics in your web pages. Or, if you do not wish to use a Google product, there are plenty of other analytics packages to keep track of visitors locally.

These packages tell you a lot more than just the number of unique visitors.

An open source alternative can be found at http://piwik.org/ . Also, see http://forge.2metz.fr/p/python-piwik/

JC Denton
+1, but I'm guessing that OP might have an intranet application, in which case I'm not sure that GA (or others) are very helpful
Chris Lawlor
They'll still offer a lot of insight into how your app is used. But I agree, not as helpful as when you're developing a public website. OP has the added benefit of just being able to approach his users..
JC Denton
+1  A: 

Step 1. Add a model -- connected users. Include an FK to username and a datetime stamp.

Step 2. Write a function to log each user's activity.

Step 3. Write your own version of login that will call the Django built-in login and also call your function to log each user's activity.

Step 4. Write a small application -- outside Django -- that uses the ORM to query the connected users table and write summaries and counts and what-not.

You have a database. Use it.

S.Lott