synthea_webservice/webservice/apps/api/apps.py

66 lines
2.6 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 = {
# 'SECURITY_DEFINITIONS': {
# 'Hawk': {
# 'type': 'apiKey',
# 'description': 'HTTP Holder-Of-Key Authentication Scheme, https://github.com/hapijs/hawk, https://hawkrest.readthedocs.io/en/latest/<br /><strong>Ex header:</strong><br />\'Authorization\': \'Hawk mac="F4+S9cu7yZiZEgdtqzMpOOdudvqcV2V2Yzk2WcphECc=", hash="+7fKUX+djeQolvnLTxr0X47e//UHKbkRlajwMw3tx3w=", id="7FI5JET4", ts="1592905433", nonce="DlV-fL"\'',
# 'name': 'Authorization',
# 'in': 'header'
# }
# }
# }
# 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 = {
# 'DEFAULT_AUTHENTICATION_CLASSES': (
# 'apps.api.authentication.APIHawk',
# ),
# 'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
# ),
# # 'DEFAULT_AUTHENTICATION_CLASSES': (
# # 'rest_framework.authentication.TokenAuthentication',
# # ),
# # 'DEFAULT_PERMISSION_CLASSES': (
# # 'rest_framework.permissions.IsAuthenticated', ),
# # 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
# }
# try:
# assert settings.HAWK_MESSAGE_EXPIRATION
# except AttributeError:
# # We only load this setting, if it is not available in the overall settings.py file
# settings.HAWK_MESSAGE_EXPIRATION = 60
def ready(self):
from . import signals