settings.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. """
  2. Django settings for pnim project.
  3. Generated by 'django-admin startproject' using Django 5.1.1.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/5.1/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/5.1/ref/settings/
  8. """
  9. from pathlib import Path
  10. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  11. BASE_DIR = Path(__file__).resolve().parent.parent
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = "django-insecure-jz-p-*^js#s7fsz0j*x*&fj!60&xy+a*j1nbp17##051^7tky%"
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = []
  19. # Application definition
  20. INSTALLED_APPS = [
  21. "django.contrib.admin",
  22. "django.contrib.auth",
  23. "django.contrib.contenttypes",
  24. "django.contrib.sessions",
  25. "django.contrib.messages",
  26. "django.contrib.staticfiles",
  27. "account",
  28. "core",
  29. "rest_framework",
  30. "drf_spectacular",
  31. ]
  32. MIDDLEWARE = [
  33. "django.middleware.security.SecurityMiddleware",
  34. "django.contrib.sessions.middleware.SessionMiddleware",
  35. "django.middleware.common.CommonMiddleware",
  36. "django.middleware.csrf.CsrfViewMiddleware",
  37. "django.contrib.auth.middleware.AuthenticationMiddleware",
  38. "django.contrib.messages.middleware.MessageMiddleware",
  39. "django.middleware.clickjacking.XFrameOptionsMiddleware",
  40. ]
  41. ROOT_URLCONF = "pnim.urls"
  42. TEMPLATES = [
  43. {
  44. "BACKEND": "django.template.backends.django.DjangoTemplates",
  45. "DIRS": [],
  46. "APP_DIRS": True,
  47. "OPTIONS": {
  48. "context_processors": [
  49. "django.template.context_processors.debug",
  50. "django.template.context_processors.request",
  51. "django.contrib.auth.context_processors.auth",
  52. "django.contrib.messages.context_processors.messages",
  53. ],
  54. },
  55. },
  56. ]
  57. WSGI_APPLICATION = "pnim.wsgi.application"
  58. # Database
  59. # https://docs.djangoproject.com/en/5.1/ref/settings/#databases
  60. DATABASES = {
  61. "default": {
  62. "ENGINE": "django.db.backends.sqlite3",
  63. "NAME": BASE_DIR / "db.sqlite3",
  64. }
  65. }
  66. # Password validation
  67. # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
  68. AUTH_PASSWORD_VALIDATORS = [
  69. {
  70. "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
  71. },
  72. {
  73. "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
  74. },
  75. {
  76. "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
  77. },
  78. {
  79. "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
  80. },
  81. ]
  82. AUTH_USER_MODEL = "account.User"
  83. # Internationalization
  84. # https://docs.djangoproject.com/en/5.1/topics/i18n/
  85. LANGUAGE_CODE = "en-us"
  86. TIME_ZONE = "UTC"
  87. USE_I18N = True
  88. USE_TZ = True
  89. # Static files (CSS, JavaScript, Images)
  90. # https://docs.djangoproject.com/en/5.1/howto/static-files/
  91. STATIC_URL = "static/"
  92. # Default primary key field type
  93. # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
  94. DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
  95. REST_FRAMEWORK = {
  96. "EXCEPTION_HANDLER": "api.exception_handlers.custom_exception_handler",
  97. "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
  98. "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
  99. }
  100. SPECTACULAR_SETTINGS = {
  101. "TITLE": "PNIM API",
  102. "DESCRIPTION": "API for PNIM project",
  103. "VERSION": "1.0.0",
  104. "SERVE_INCLUDE_SCHEMA": False,
  105. "SCHEMA_PATH_PREFIX": "/openapi/",
  106. }