- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Django model object hit counting
In this article, we are going to make a project in which we will see how to make a Django table that will store all the data of hit count and detailed data of hit. It can be used generate useful reports. So, let's get started.
Setup your urls.py and install the django-hitcount module
pip install django-hitcount
In settings.py, add the following line −
INSTALLED_APPS+ = ['hitcount']
Here we added this library as an app in the project.
Run the following commands −
python manage.py makemigrations python manage.py migrate
Here, we create migrations and then we migrate it.
That's all. This library will create a table that will store all the data.
Go to http://127.0.0.1 and login
Hit counts and Hits contain what we wanted, you can explore other two.
Kickstart Your Career
Get certified by completing the courseGet Started