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.2a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c91f9d13e44bcb58c1cfb51daf309c3ca4b67d5100c04932157b0ef64627ff4 |
|
MD5 | 3158f0821d08922cc0616faee15823e8 |
|
BLAKE2b-256 | b8fa3f2b3119e23f12ebc1b76d82d1fac7d0ad1b7d59109fde0bb7a8d587b6ff |
Close
Hashes for djangomicroframework-0.0.2a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2280b4dbf1e3cbd4e912ec733360f2daa3853af74a6f22ceb23eed1682c4b4c1 |
|
MD5 | 799ce5da6500854a57ffef7ffc660d92 |
|
BLAKE2b-256 | 8f9b2fc22ceece02920fefd35d56f7fd18dd15155841d7674c3e5c80c24fedcf |