No Description

settings.py 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. """
  2. Django settings for restful project.
  3. Generated by 'django-admin startproject' using Django 3.1.2.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/3.1/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/3.1/ref/settings/
  8. """
  9. from pathlib import Path
  10. import os
  11. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  12. BASE_DIR = Path(__file__).resolve().parent.parent
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = 'j(q!!tj1a0yae#js(^7h-@y(g%=no817zm_t5*mf@p0t53l3qf'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. import os
  20. LOGGING = {
  21. 'version': 1,
  22. 'disable_existing_loggers': False,
  23. 'handlers': {
  24. 'console': {
  25. 'class': 'logging.StreamHandler',
  26. },
  27. },
  28. 'loggers': {
  29. 'django': {
  30. 'handlers': ['console'],
  31. 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
  32. },
  33. },
  34. }
  35. # Application definition
  36. INSTALLED_APPS = [
  37. 'django.contrib.admin',
  38. 'django.contrib.auth',
  39. 'django.contrib.contenttypes',
  40. 'django.contrib.sessions',
  41. 'django.contrib.messages',
  42. 'django.contrib.staticfiles',
  43. 'CompanionApp',
  44. 'rest_framework',
  45. 'rest_framework.authtoken',
  46. 'rest_auth',
  47. 'django.contrib.sites',
  48. 'allauth',
  49. 'allauth.account',
  50. 'rest_auth.registration',
  51. 'allauth.socialaccount',
  52. 'allauth.socialaccount.providers.facebook',
  53. 'allauth.socialaccount.providers.google',
  54. 'corsheaders',
  55. ]
  56. SITE_ID = 4
  57. MIDDLEWARE = [
  58. 'django.middleware.security.SecurityMiddleware',
  59. 'django.contrib.sessions.middleware.SessionMiddleware',
  60. 'django.middleware.common.CommonMiddleware',
  61. 'django.middleware.csrf.CsrfViewMiddleware',
  62. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  63. 'django.contrib.messages.middleware.MessageMiddleware',
  64. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  65. 'corsheaders.middleware.CorsMiddleware',
  66. 'django.middleware.common.CommonMiddleware',
  67. ]
  68. ROOT_URLCONF = 'restful.urls'
  69. TEMPLATES = [
  70. {
  71. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  72. 'DIRS': [],
  73. 'APP_DIRS': True,
  74. 'OPTIONS': {
  75. 'context_processors': [
  76. 'django.template.context_processors.debug',
  77. 'django.template.context_processors.request',
  78. 'django.contrib.auth.context_processors.auth',
  79. 'django.contrib.messages.context_processors.messages',
  80. ],
  81. },
  82. },
  83. ]
  84. REST_FRAMEWORK = {
  85. 'DEFAULT_AUTHENTICATION_CLASSES': (
  86. 'rest_framework.authentication.TokenAuthentication',
  87. 'rest_framework.authentication.SessionAuthentication',
  88. 'rest_framework.authentication.BasicAuthentication'
  89. ),
  90. 'DEFAULT_PERMISSION_CLASSES': (
  91. 'rest_framework.permissions.IsAuthenticated', )
  92. }
  93. ALLOWED_HOSTS = ['*']
  94. AUTH_USER_MODEL = 'CompanionApp.User' # new
  95. WSGI_APPLICATION = 'restful.wsgi.application'
  96. # Database
  97. # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
  98. DATABASES = {
  99. 'default': {
  100. 'ENGINE': 'django.db.backends.postgresql',
  101. 'NAME': 'iupi',
  102. 'USER': 'postgres',
  103. 'PASSWORD': 'diego',
  104. 'HOST': 'localhost'
  105. }
  106. }
  107. # Password validation
  108. # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
  109. AUTH_PASSWORD_VALIDATORS = [
  110. {
  111. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  112. },
  113. {
  114. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  115. },
  116. {
  117. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  118. },
  119. {
  120. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  121. },
  122. ]
  123. # Internationalization
  124. # https://docs.djangoproject.com/en/3.1/topics/i18n/
  125. LANGUAGE_CODE = 'en-us'
  126. TIME_ZONE = 'UTC'
  127. USE_I18N = True
  128. USE_L10N = True
  129. USE_TZ = True
  130. # Static files (CSS, JavaScript, Images)
  131. # https://docs.djangoproject.com/en/3.1/howto/static-files/
  132. STATIC_URL = '/static/'