Repository for EasyVisitor Django app-middleware
MIT License
EasyVisitors is a simple to use Django App that counts website visitors and displays them without any hassles. It uses cookies to keep a track of how many people visited you website and doesnot increments simply upon a refresh unlike other simple counters.
Installation is same for virtualenv and non virtualenv (because it is that simple XD)
> pip install EasyVisitors
In settings.py
of your django project -
INSTALLED_APPS = [
...
'EasyVisitors',
...
]
MIDDLEWARE = [
...
'EasyVisitors.middleware.VisitorCounterMiddleware',
...
]
It is a local counter so it is necessary to create some space for recording it's values in the database. But no worries all of it has been taken care off. You just have to run -
> python manage.py makemigrations EasyVisitors
> python manage.py migrate EasyVisitors
This will create a simple table to store the values of the counter in the database. This step is very important as without these migrations the app wont be able to run as it wont be able to store it's values and hence will show an error.
This simple to configure app is also simple to use. To use the value of counter in your templates -
{{ request.visitors }}
And to use it anywhere else -
request.visitors
In settings.py
of your django project you can customize some aspects of EasyVisitors app -
None
then the counter will stay at that value forever untill changed to None
after which it begins counting from that value.None
Deekshant Wadhwa
MIT