Django application for saving IP adresses visiting a web application.
Project description
Django IP logger
Django application for saving IP adresses visiting a web application.
Intro
As your web application scales, you will often encounter different reasons to keep track of IP Addresses. Perhaps, you just rolled out an Advert application and need to track visits and interactions in the back-end; perhaps, an 'evil' IP address continously pesters your endpoints without provocation and you'd like to implement a blacklist; better still, you need to track visitors across web pages on a 'IP' basis rather than just sessions.
Or perhaps, you have this biting need to have fun and fill production DBs with IP adresses whether you need it or not.
This application is a quite simple and effective solution to that.
How to do?
It's quite simple to use. Install with:
pip install django-ip-logger
Next step is to add ip_logger
to your INSTALLED_APPS like so:
INSTALLED_APPS = [
#... apps I don't care about here
'ip_logger',
]
Next is to add ip_logger.middleware.LogIPMiddleware
to the top of the list of MIDDLEWARES:
MIDDLEWARE = [
'ip_logger.middleware.LogIPMiddleware',
# ... stuffs that's not my business
]
Working?
To test it's working, visit a random URL on your webapp and check that your IP has been added to the list.
FAQs
-
Why don't you save other stuffs like requests, responses, response time, queries, url paths and the sorts? For the sake of generalization and to prevent bloating, I've decided to save only IPs, first visit and recent visit time. This is to ensure your DB is not populated with lots of rows for the sake of 'robust-ness'. Most web apps won't need it. If you do, implement it yourself, you've got the
IPAdress
model there for you. -
Do I need additional configurations? No, boss... You don't.
-
Nothing's working, I've tried every possible option Quit the project, it's not worth it.
-
This stuff is too simple, why implement it? Since you didn't implement it, I did.
-
Why did you choose this name for the package? Don't question my decisions. It took me 3 days to make this decision.
-
Is this package needed? Depends.
Bugs?
Raise an issue, I'll check it out.
Contributions?
Oh well... Make a PR
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-ip-logger-1.0.1.tar.gz
.
File metadata
- Download URL: django-ip-logger-1.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c603e77defde7c335b90031453c2e89efdf5aca70fca242af480ff2444b1a40c |
|
MD5 | 06ef086f7ef47dffb54a0e7109896308 |
|
BLAKE2b-256 | 5cac8db18239aeb84ec079cc8009f548dfc3e804882dd4ee62c0a364b46ed166 |
File details
Details for the file django_ip_logger-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: django_ip_logger-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e26cbde81681a780618784e10e2d39afd435c4ff2f0e4151cfbfc1a09d2fc6 |
|
MD5 | cad18a757c060aed26252e9c098e3567 |
|
BLAKE2b-256 | b8ac7c635881116ec5106b290c2cc75aada942434f5692080d4d4fcd17ea4bc6 |