settings.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. """
  2. Django settings for mysuitablephone project.
  3. Generated by 'django-admin startproject' using Django 4.1.4.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/4.1/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/4.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/4.1/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'django-insecure-+$i2ntzli6&4!d7#n9kidpmd8-#02eem(7%jvn@+##4^$=yci%'
  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. 'django_filters',
  28. 'rest_framework',
  29. 'suitablephones',
  30. 'corsheaders',
  31. 'debug_toolbar',
  32. ]
  33. MIDDLEWARE = [
  34. 'django.middleware.security.SecurityMiddleware',
  35. 'django.contrib.sessions.middleware.SessionMiddleware',
  36. 'django.middleware.common.CommonMiddleware',
  37. 'django.middleware.csrf.CsrfViewMiddleware',
  38. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  39. 'django.contrib.messages.middleware.MessageMiddleware',
  40. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  41. 'corsheaders.middleware.CorsMiddleware',
  42. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  43. ]
  44. CORS_ORIGIN_WHITELIST = [
  45. "http://localhost:5173",
  46. ]
  47. ROOT_URLCONF = 'mysuitablephone.urls'
  48. TEMPLATES = [
  49. {
  50. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  51. 'DIRS': [],
  52. 'APP_DIRS': True,
  53. 'OPTIONS': {
  54. 'context_processors': [
  55. 'django.template.context_processors.debug',
  56. 'django.template.context_processors.request',
  57. 'django.contrib.auth.context_processors.auth',
  58. 'django.contrib.messages.context_processors.messages',
  59. ],
  60. },
  61. },
  62. ]
  63. WSGI_APPLICATION = 'mysuitablephone.wsgi.application'
  64. # Database
  65. # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
  66. #DATABASES = {
  67. # 'default': {
  68. # 'ENGINE': 'django.db.backends.sqlite3',
  69. # 'NAME': BASE_DIR / 'db.sqlite3',
  70. # }
  71. #}
  72. DATABASES = {
  73. 'default': {
  74. 'ENGINE': 'django.db.backends.postgresql',
  75. "NAME": "suitablephones",
  76. "USER": "postgres",
  77. "PASSWORD": "postgres",
  78. "HOST": "localhost",
  79. 'PORT': 5432,
  80. }
  81. }
  82. # Password validation
  83. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  84. AUTH_PASSWORD_VALIDATORS = [
  85. {
  86. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  87. },
  88. {
  89. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  90. },
  91. {
  92. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  93. },
  94. {
  95. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  96. },
  97. ]
  98. # Internationalization
  99. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  100. LANGUAGE_CODE = 'en-us'
  101. TIME_ZONE = 'UTC'
  102. USE_I18N = True
  103. USE_TZ = True
  104. # Static files (CSS, JavaScript, Images)
  105. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  106. STATIC_URL = 'static/'
  107. # Default primary key field type
  108. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  109. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  110. REST_FRAMEWORK = {
  111. 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']
  112. }
  113. from .settings_local import *