Start REST API for autocompletion etc.
This commit is contained in:
@@ -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/
|
||||
|
@@ -23,5 +23,6 @@ from parts import views as parts_views
|
||||
urlpatterns = [
|
||||
url(r'^admin/login/', parts_views.login_view),
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/v1/', include('api.urls')),
|
||||
path('', include('parts.urls')),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
Reference in New Issue
Block a user