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.2a5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2b7140aa5c1981d2c9b1a422e49be32e0f93875d2663cfe92d93692a8a45d7 |
|
MD5 | 6686ab0b5422f1b61b4635d7edb41b2f |
|
BLAKE2b-256 | b3ac26e1c5226b5d76a30a2f945ce3e0200be8bceaf79a5955618e31f712dd3d |
Close
Hashes for djangomicroframework-0.0.2a5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5eec0a0e6670519926a1114ae32474daeb21061439c9c55bccbdd4ded464945 |
|
MD5 | 5ac94f1d5f94413f27364e58334bf0bd |
|
BLAKE2b-256 | 3c1e5747f8332c0dc24959358e43c8a41516c09ee39e88729b57135cca8b8f07 |