Micro framework for Django
Project description
Django Micro framework
Micro framework for Django REST Framework
Requirements
- Python (3.6)
- Django (2.0, 2.1, 2.2, 3.0)
- Django REST Framework (3.8, 3.9, 3.10)
Installation
Micro Framework can be installed with pip
pip install djangomicroframework
Then, go to your django project. In settings.py
:
REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
'rest_framework.parsers.FormParser',
'rest_framework.parsers.MultiPartParser'
),
'DEFAULT_AUTHENTICATION_CLASSES': [
'micro_framework.jwt_auth.authentication.JWTTokenUserAuthentication',
]
}
from datetime import timedelta
MICRO_FRAMEWORK = {
'SERVICE_NAME': 'Default',
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'ROTATE_REFRESH_TOKENS': False,
'BLACKLIST_AFTER_ROTATION': True,
'ALGORITHM': 'HS256',
'SIGNING_KEY': settings.SECRET_KEY,
'VERIFYING_KEY': None,
'AUDIENCE': None,
'ISSUER': None,
'AUTH_HEADER_TYPES': ('Bearer',),
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
'AUTH_TOKEN_CLASSES': ('micro_framework.jwt_auth.tokens.AccessToken',),
'TOKEN_TYPE_CLAIM': 'token_type',
'JTI_CLAIM': 'jti',
# Custom payload Token
'ADD_USER_IP_CLAIM': False,
'USER_IP_CLAIM': 'user_ip',
'ADD_USER_AGENT_CLAIM': False,
'USER_AGENT_CLAIM': 'user_agent',
'VALIDATE_SOURCE_IP': False,
'HEADER_IP_REMOTE': ['HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR'],
# Redis backend
'REDIS_ENABLE': False,
'REDIS_HOST': 'localhost',
'REDIS_PORT': 6379,
'REDIS_PASSWORD': None,
'REDIS_DB': 0,
'REDIS_EXPIRE_TOKEN': False,
}
Acknowledgments
This project is forked and custom from https://github.com/davesque/django-rest-framework-simplejwt
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
Close
Hashes for djangomicroframework-0.0.2a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee435e5bdf72c4872deb228d9e8c24c7654a35272c287569a2d89dfb4e6266b |
|
MD5 | 339fc577fa80c5e982b10f2da52243d0 |
|
BLAKE2b-256 | b6e9b4c51a5ef07feb7378948b4df3003e6a459922541cb966fc816085fa71ff |
Close
Hashes for djangomicroframework-0.0.2a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2ae911ea6541ab3a059a7c58f4972c284f557e969b43aa685927b7e2e3bdb3a |
|
MD5 | a7c19b8e422cfc2511bc17f1e729cec6 |
|
BLAKE2b-256 | 7296379e0576d60c29765a1213da4b4abdcf8687fb9ad6b0796447bf50a0a8a2 |