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.1a4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ccc23ad3b59eea0911516e0cf770d434800db093fedc0af777f1706e15f37b5 |
|
MD5 | b58625e7e9640cc4d36a59bcb73395e5 |
|
BLAKE2b-256 | 74c03afc7db08fe6e49169b24756286f19eac5ee49583fcf8198cbc8b2eb4a2c |
Close
Hashes for djangomicroframework-0.0.1a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac6e600405ad6d39bfd7149e6f58ec5a4789aca3c805bbf72074c4986e18917 |
|
MD5 | 0f1c82cc89971524f0c86c5d24f7dceb |
|
BLAKE2b-256 | d00da8150c01a58af6554480b66ecd900dd208de22d698724bbe3d311ca739f6 |