· 4 years ago · Jul 22, 2021, 10:04 AM
1"""
2Django settings for marketplace project.
3
4Generated by 'django-admin startproject' using Django 3.2.4.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.2/ref/settings/
11"""
12import os
13from pathlib import Path
14
15
16BASE_DIR = Path(__file__).resolve().parent.parent
17SECRET_KEY = os.environ.get("SECRET_KEY")
18DEBUG = True if os.environ.get("DEBUG") == "True" else False
19
20ALLOWED_HOSTS = []
21
22INSTALLED_APPS = [
23 "django.contrib.admin",
24 "django.contrib.auth",
25 "django.contrib.contenttypes",
26 "django.contrib.sessions",
27 "django.contrib.messages",
28 "django.contrib.staticfiles",
29 "rest_framework",
30 "rest_framework_simplejwt",
31 "users",
32 "corsheaders",
33]
34
35MIDDLEWARE = [
36 "django.middleware.security.SecurityMiddleware",
37 "django.contrib.sessions.middleware.SessionMiddleware",
38 "django.middleware.common.CommonMiddleware",
39 "django.middleware.csrf.CsrfViewMiddleware",
40 "django.contrib.auth.middleware.AuthenticationMiddleware",
41 "django.contrib.messages.middleware.MessageMiddleware",
42 "django.middleware.clickjacking.XFrameOptionsMiddleware",
43 'corsheaders.middleware.CorsMiddleware',
44]
45
46ROOT_URLCONF = "marketplace.urls"
47
48TEMPLATES = [
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
64WSGI_APPLICATION = "marketplace.wsgi.application"
65
66DATABASES = {
67 "default": {
68 "ENGINE": "django.db.backends.sqlite3",
69 "NAME": BASE_DIR / "db.sqlite3",
70 }
71}
72
73AUTH_PASSWORD_VALIDATORS = [
74 {
75 "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
76 },
77 {
78 "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
79 },
80 {
81 "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
82 },
83 {
84 "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
85 },
86]
87
88REST_FRAMEWORK = {
89 'DEFAULT_AUTHENTICATION_CLASSES': (
90 'rest_framework_simplejwt.authentication.JWTAuthentication',
91 )
92}
93
94LANGUAGE_CODE = "en-us"
95
96TIME_ZONE = "UTC"
97
98USE_I18N = True
99
100USE_L10N = True
101
102USE_TZ = True
103
104STATIC_URL = "/static/"
105DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
106AUTH_USER_MODEL = "users.User"
107
108CORS_ORIGIN_WHITELIST = [
109 'http://localhost:3000'
110]
111