Start REST API for autocompletion etc.

This commit is contained in:
2021-08-07 19:47:34 +02:00
parent ec0a8c98e7
commit 3a68972c03
12 changed files with 232 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'parts.apps.PartsConfig',
'qr_code',
'rest_framework'
]
MIDDLEWARE = [
@@ -113,6 +114,27 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'api.ExpiringAuthToken.ExpiringTokenAuthentication',
],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 10,
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.UserRateThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'user': '2000/hour'
}
}
REST_FRAMEWORK_TOKEN_EXPIRE_HOURS = 4
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/