DJANGO-SEARCH-STATISTIC
Installation
pip install django-search-statistic
Add search_statistic to settings.INSTALLED_APPS
Add ‘search_statistic.middleware.CollectStatisticMiddleware’ to settings.MIDDLEWARE_CLASSES
python manage.py migrate search_statistic
Usage
If you want specify content_type and object_pk (default only path is stored) you must add to your views: from search_statistic.utils.visits import visit_object
def some_view(request):
obj = SomeModel.objects.get(pk=pk)
visit_object(request, obj)
Settings
All settings stored in settings.SEARCH_STATISTIC. Default value is:
{
‘REDIS_CACHE_SIZE’: 1,
‘REDIS_PREFIX’: ‘django-search-statistic’,
‘REDIS_SETTINGS’: {
‘db’: 1
},
‘REMOVE_ON_STATUS’: [400, 403, 404, 405],
‘default_query_confirm’: False,
}
Options REDIS_* are using only where redis are installed. If REDIS_CACHE_SIZE <= 0 - search queries will storing in redis infinitely. If REDIS_CACHE_SIZE == 1 - redis isn’t using If REDIS_CACHE_SIZE >= 2 - search queries and visits are storing in cache, but after REDIS_CACHE_SIZE objects in cache they will be saved in DB
If response status code in REMOVE_ON_STATUS all visits with path == current request.path are deleteing.
Metadata
Release files for django-search-statistic 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-search-statistic-0.0.2.tar.gz | 15.7 kB | Without provenance | Details for django-search-statistic-0.0.2.tar.gz |
Release files / django-search-statistic-0.0.2.tar.gz
| Download URL | django-search-statistic-0.0.2.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc8f1e3b797c1587b6da31e7842aa0f2c09f8250ac993114a3112da147f4a868
|
|
BLAKE2b-256 checksum How to use checksums |
4389b2be5595feb268c3376e23ae529ba0fb77aadf9cb8b0e22568d4d89c3923
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-search-statistic 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.