top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Django, how to count the number of active visitors in a website and I have to display their respective IP Address.

+1 vote
1,632 views

I want to count the number of active user in website and also I have to display their IP Address by using python Django framework.

posted Dec 18, 2014 by Avinash Ks

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You can install django-tracking which provides following features -

  1. Tracks the following information about your visitors:
    Session key
    IP address
    User agent
    Whether or not they are a registered user and logged in
    Where they came from (http-referer)
    What page on your site they last visited
    How many pages on your site they have visited
    Allows user-agent filtering for visitor tracking

  2. Automatic clean-up of old visitor records
    Can ban certain IP addresses, rendering the site useless to visitors from those IP's (great for stopping spam)

  3. The ability to have a live feed of active users on your website

  4. Template tags to:
    display how many active users there are on your site (THIS IS WHAT YOU R ASKING)
    determine how many active users are on the same page within your site
    Optional "Active Visitors Map" to see where visitors are in the world

Installation

pip install django-tracking
answer Dec 18, 2014 by Salil Agrawal
I already tried this but am not able to install this package: i am getting this error.
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Its clearly saying that You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Better if you could raise a fresh question, with proper info what you are trying to achieve, what is the problem, what is the error and what is expected. People should be able to help you.
Similar Questions
+1 vote
avinash@dell ~ $ sudo pip install django-tracking

Downloading/unpacking django-tracking
Downloading django-tracking-0.4.1.tar.gz (1.9MB): 1.9MB downloaded
Running setup.py (path:/tmp/pip_build_root/django-tracking/setup.py) egg_info for package django-tracking
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip_build_root/django-tracking/setup.py", line 6, in
import tracking
File "tracking/__init__.py", line 1, in
import listeners
File "tracking/listeners.py", line 6, in
from django.core.cache import cache
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 34, in
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 17, in

File "/tmp/pip_build_root/django-tracking/setup.py", line 6, in

import tracking

File "tracking/__init__.py", line 1, in

import listeners

File "tracking/listeners.py", line 6, in

from django.core.cache import cache

File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 34, in

if DEFAULT_CACHE_ALIAS not in settings.CACHES:

File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in __getattr__

self._setup(name)

File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 40, in _setup

% (desc, ENVIRONMENT_VARIABLE))

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

+2 votes

I am trying to learn Django. My initial exercise seems fine. I want to create an API with REST on Django for an interactive Python code. REST framework on Django I am understanding more or less.

I am looking for a simple example to start with. I am using Python 2.7+ on MS-Windows 7 Professional.

If any one may kindly suggest.

+2 votes
(venv)avinash@dell ~/django_projects/usertracking $ python manage.py runserver 113.193.144.56:80
Performing system checks...

System check identified no issues (0 silenced).
December 27, 2014 - 13:12:42
Django version 1.7.1, using settings 'usertracking.settings'
Starting development server at http://113.193.144.56:80/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned-to.
+4 votes

I am getting the following error -

UserProfile.picture: (fields.E210) Cannot use ImageField because Pillow is not installed.

HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install pillow".
System check identified 1 issue (0 silenced).

This is installation Summary of pillow

PIL SETUP SUMMARY
version Pillow 2.6.1
platform linux 3.4.2 (default, Oct 8 2014, 13:08:17) [GCC 4.9.1]

--- TKINTER support available
--- JPEG support available
--- OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
--- LIBTIFF support available
--- FREETYPE2 support available
--- LITTLECMS2 support available
--- WEBP support available
--- WEBPMUX support available
+1 vote

Is it possible to display a data grid table with django? Basically I am looking for displaying a data from the db table on the web interface through django or some other web interface.

My main application is in Python, that's why I'd like to explore Python possibilities first.

...