37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
from django.apps import AppConfig
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from django.conf import settings
|
|
|
|
class ApiConfig(AppConfig):
|
|
name = 'apps.api'
|
|
label = 'api'
|
|
verbose_name = _('API')
|
|
verbose_name_plural = _('APIs')
|
|
|
|
try:
|
|
assert settings.SWAGGER_SETTINGS
|
|
except AttributeError:
|
|
# We only load this setting, if it is not available in the overall settings.py file
|
|
settings.SWAGGER_SETTINGS = {
|
|
}
|
|
|
|
try:
|
|
assert settings.REST_FRAMEWORK
|
|
except AttributeError:
|
|
# We only load this setting, if it is not available in the overall settings.py file
|
|
# To protect all API views with Hawk by default, put this in your settings:
|
|
# https://hawkrest.readthedocs.io/en/latest/usage.html#protecting-api-views-with-hawk
|
|
settings.REST_FRAMEWORK = {
|
|
|
|
# Use Django's standard `django.contrib.auth` permissions,
|
|
# or allow read-only access for unauthenticated users.
|
|
# 'DEFAULT_PERMISSION_CLASSES': [
|
|
# 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
|
# ],
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
|
'PAGE_SIZE': 10
|
|
}
|
|
|
|
def ready(self):
|
|
from . import signals |