Fixed #205: Disabled browsable HTML API in production

This commit is contained in:
Eliot Berriot 2018-05-15 19:06:08 +02:00
parent 8d2529f4f7
commit 155a40e296
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
3 changed files with 12 additions and 0 deletions

View File

@ -9,3 +9,4 @@ FUNKWHALE_PROTOCOL=http
PYTHONDONTWRITEBYTECODE=true PYTHONDONTWRITEBYTECODE=true
WEBPACK_DEVSERVER_PORT=8080 WEBPACK_DEVSERVER_PORT=8080
MUSIC_DIRECTORY_PATH=/music MUSIC_DIRECTORY_PATH=/music
BROWSABLE_API_ENABLED=True

View File

@ -406,8 +406,18 @@ REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': ( 'DEFAULT_FILTER_BACKENDS': (
'rest_framework.filters.OrderingFilter', 'rest_framework.filters.OrderingFilter',
'django_filters.rest_framework.DjangoFilterBackend', 'django_filters.rest_framework.DjangoFilterBackend',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
) )
} }
BROWSABLE_API_ENABLED = env.bool('BROWSABLE_API_ENABLED', default=False)
if BROWSABLE_API_ENABLED:
REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] += (
'rest_framework.renderers.BrowsableAPIRenderer',
)
REST_AUTH_SERIALIZERS = { REST_AUTH_SERIALIZERS = {
'PASSWORD_RESET_SERIALIZER': 'funkwhale_api.users.serializers.PasswordResetSerializer' # noqa 'PASSWORD_RESET_SERIALIZER': 'funkwhale_api.users.serializers.PasswordResetSerializer' # noqa
} }

View File

@ -0,0 +1 @@
Disabled browsable HTML API in production (#205)