GithubHelp home page GithubHelp logo

deekshant-w / easyvisitor Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 80 KB

Repository for EasyVisitor Django app-middleware

License: MIT License

Python 100.00%
python django python3 django-application django-app django-middleware

easyvisitor's Introduction

EasyVisitors

PyPI - Python Version GitHub last commit GitHub release (latest by date) PyPI version GitHub issues PyPI 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.

  • Easy to use
  • Easy to setup
  • Easy to configure
  • Easy to customize

Installation

Installation is same for virtualenv and non virtualenv (because it is that simple XD)

> pip install EasyVisitors

Configration

In settings.py of your django project -

INSTALLED_APPS = [
    ...
    'EasyVisitors',
    ...
]
MIDDLEWARE = [
    ...
    'EasyVisitors.middleware.VisitorCounterMiddleware',
    ...
]

Getting Started

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.

Using the app

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

Customization

In settings.py of your django project you can customize some aspects of EasyVisitors app -

  1. EASY_COUNTER_VISITOR_ALIVE_TIME - It determines how long a visitor is concidered as a unit and after that time, that user is concidered as a new vsitor. Datatype : int
    Unit : seconds
    Default: 300
     
  2. EASY_COUNTER_IGNORED_PATHS - List comprising of all paths, which donot alter the state of the counter upon being visited.
    Datatype : list
    Default: ['/admin']
     
  3. EASY_COUNTER_RESET - Value for the counter to begin from upon next refresh of any page. If it has any value except None then the counter will stay at that value forever untill changed to None after which it begins counting from that value.
    Datatype : int
    Default: None
    OnChange : Counter stay at the changed value
     

Creator

Deekshant Wadhwa

License

MIT

easyvisitor's People

Contributors

deekshant-w avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.