2121# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
2222
2323# SECURITY WARNING: keep the secret key used in production secret!
24- SECRET_KEY = ' django-insecure-$m!=ol!ylq@0j#^fg66^%3+blyo*_fyog01ax3vhj_c4#abykz'
24+ SECRET_KEY = " django-insecure-$m!=ol!ylq@0j#^fg66^%3+blyo*_fyog01ax3vhj_c4#abykz"
2525
2626# SECURITY WARNING: don't run with debug turned on in production!
2727DEBUG = True
3232# Application definition
3333
3434INSTALLED_APPS = [
35- ' django.contrib.admin' ,
36- ' django.contrib.auth' ,
37- ' django.contrib.contenttypes' ,
38- ' django.contrib.sessions' ,
39- ' django.contrib.messages' ,
40- ' django.contrib.staticfiles' ,
41- ' blog_api' ,
42- ' rest_framework' ,
43- ' corsheaders' ,
44- ' users' ,
45- ' rest_framework_simplejwt.token_blacklist' ,
35+ " django.contrib.admin" ,
36+ " django.contrib.auth" ,
37+ " django.contrib.contenttypes" ,
38+ " django.contrib.sessions" ,
39+ " django.contrib.messages" ,
40+ " django.contrib.staticfiles" ,
41+ " blog_api" ,
42+ " rest_framework" ,
43+ " corsheaders" ,
44+ " users" ,
45+ " rest_framework_simplejwt.token_blacklist" ,
4646]
4747
4848MIDDLEWARE = [
49- ' django.middleware.security.SecurityMiddleware' ,
50- ' django.contrib.sessions.middleware.SessionMiddleware' ,
51- ' corsheaders.middleware.CorsMiddleware' ,
52- ' django.middleware.common.CommonMiddleware' ,
53- ' django.middleware.csrf.CsrfViewMiddleware' ,
54- ' django.contrib.auth.middleware.AuthenticationMiddleware' ,
55- ' django.contrib.messages.middleware.MessageMiddleware' ,
56- ' django.middleware.clickjacking.XFrameOptionsMiddleware' ,
49+ " django.middleware.security.SecurityMiddleware" ,
50+ " django.contrib.sessions.middleware.SessionMiddleware" ,
51+ " corsheaders.middleware.CorsMiddleware" ,
52+ " django.middleware.common.CommonMiddleware" ,
53+ " django.middleware.csrf.CsrfViewMiddleware" ,
54+ " django.contrib.auth.middleware.AuthenticationMiddleware" ,
55+ " django.contrib.messages.middleware.MessageMiddleware" ,
56+ " django.middleware.clickjacking.XFrameOptionsMiddleware" ,
5757]
5858
59- ROOT_URLCONF = ' blog.urls'
59+ ROOT_URLCONF = " blog.urls"
6060
6161TEMPLATES = [
6262 {
63- ' BACKEND' : ' django.template.backends.django.DjangoTemplates' ,
64- ' DIRS' : [],
65- ' APP_DIRS' : True ,
66- ' OPTIONS' : {
67- ' context_processors' : [
68- ' django.template.context_processors.debug' ,
69- ' django.template.context_processors.request' ,
70- ' django.contrib.auth.context_processors.auth' ,
71- ' django.contrib.messages.context_processors.messages' ,
63+ " BACKEND" : " django.template.backends.django.DjangoTemplates" ,
64+ " DIRS" : [],
65+ " APP_DIRS" : True ,
66+ " OPTIONS" : {
67+ " context_processors" : [
68+ " django.template.context_processors.debug" ,
69+ " django.template.context_processors.request" ,
70+ " django.contrib.auth.context_processors.auth" ,
71+ " django.contrib.messages.context_processors.messages" ,
7272 ],
7373 },
7474 },
7575]
7676
77- WSGI_APPLICATION = ' blog.wsgi.application'
77+ WSGI_APPLICATION = " blog.wsgi.application"
7878
7979
8080# Database
8181# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
8282
8383DATABASES = {
84- ' default' : {
85- ' ENGINE' : ' django.db.backends.sqlite3' ,
86- ' NAME' : BASE_DIR / ' db.sqlite3' ,
84+ " default" : {
85+ " ENGINE" : " django.db.backends.sqlite3" ,
86+ " NAME" : BASE_DIR / " db.sqlite3" ,
8787 }
8888}
8989
9393
9494AUTH_PASSWORD_VALIDATORS = [
9595 {
96- ' NAME' : ' django.contrib.auth.password_validation.UserAttributeSimilarityValidator' ,
96+ " NAME" : " django.contrib.auth.password_validation.UserAttributeSimilarityValidator" ,
9797 },
9898 {
99- ' NAME' : ' django.contrib.auth.password_validation.MinimumLengthValidator' ,
99+ " NAME" : " django.contrib.auth.password_validation.MinimumLengthValidator" ,
100100 },
101101 {
102- ' NAME' : ' django.contrib.auth.password_validation.CommonPasswordValidator' ,
102+ " NAME" : " django.contrib.auth.password_validation.CommonPasswordValidator" ,
103103 },
104104 {
105- ' NAME' : ' django.contrib.auth.password_validation.NumericPasswordValidator' ,
105+ " NAME" : " django.contrib.auth.password_validation.NumericPasswordValidator" ,
106106 },
107107]
108108
109109
110110# Internationalization
111111# https://docs.djangoproject.com/en/3.2/topics/i18n/
112112
113- LANGUAGE_CODE = ' en-us'
113+ LANGUAGE_CODE = " en-us"
114114
115- TIME_ZONE = ' UTC'
115+ TIME_ZONE = " UTC"
116116
117117USE_I18N = True
118118
124124# Static files (CSS, JavaScript, Images)
125125# https://docs.djangoproject.com/en/3.2/howto/static-files/
126126
127- STATIC_URL = ' /static/'
127+ STATIC_URL = " /static/"
128128
129129# Default primary key field type
130130# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
131131
132- DEFAULT_AUTO_FIELD = ' django.db.models.BigAutoField'
132+ DEFAULT_AUTO_FIELD = " django.db.models.BigAutoField"
133133
134- CORS_ALLOWED_ORIGINS = [
135- 'http://127.0.0.1:8000' ,
136- 'http://localhost:3000'
137- ]
134+ CORS_ALLOWED_ORIGINS = ["http://127.0.0.1:8000" , "http://localhost:3000" ]
138135
139136REST_FRAMEWORK = {
140- ' DEFAULT_PERMISSION_CLASSES' : [
141- ' rest_framework.permissions.IsAuthenticatedOrReadOnly' ,
137+ " DEFAULT_PERMISSION_CLASSES" : [
138+ " rest_framework.permissions.IsAuthenticatedOrReadOnly" ,
142139 ],
143-
144- 'DEFAULT_AUTHENTICATION_CLASSES' : (
145- 'rest_framework_simplejwt.authentication.JWTAuthentication' ,
146- 'rest_framework.authentication.SessionAuthentication' ,
147- )
140+ "DEFAULT_AUTHENTICATION_CLASSES" : (
141+ "rest_framework_simplejwt.authentication.JWTAuthentication" ,
142+ "rest_framework.authentication.SessionAuthentication" ,
143+ ),
148144}
149145
150146SIMPLE_JWT = {
151- ' ACCESS_TOKEN_LIFETIME' : timedelta (minutes = 1 ),
152- ' REFRESH_TOKEN_LIFETIME' : timedelta (days = 10 ),
153- ' ROTATE_REFRESH_TOKENS' : True ,
154- ' BLACKLIST_AFTER_ROTATION' : True ,
155- ' ALGORITHM' : ' HS256' ,
156- ' SIGNING_KEY' : SECRET_KEY ,
157- ' VERIFYING_KEY' : None ,
158- ' AUTH_HEADER_TYPES' : (' JWT' ,),
159- ' USER_ID_FIELD' : ' username' ,
160- ' USER_ID_CLAIM' : ' user_username' ,
161- ' AUTH_TOKEN_CLASSES' : (' rest_framework_simplejwt.tokens.AccessToken' ,),
162- ' TOKEN_TYPE_CLAIM' : ' token_type' ,
163- }
147+ " ACCESS_TOKEN_LIFETIME" : timedelta (minutes = 1 ),
148+ " REFRESH_TOKEN_LIFETIME" : timedelta (days = 10 ),
149+ " ROTATE_REFRESH_TOKENS" : True ,
150+ " BLACKLIST_AFTER_ROTATION" : True ,
151+ " ALGORITHM" : " HS256" ,
152+ " SIGNING_KEY" : SECRET_KEY ,
153+ " VERIFYING_KEY" : None ,
154+ " AUTH_HEADER_TYPES" : (" JWT" ,),
155+ " USER_ID_FIELD" : " username" ,
156+ " USER_ID_CLAIM" : " user_username" ,
157+ " AUTH_TOKEN_CLASSES" : (" rest_framework_simplejwt.tokens.AccessToken" ,),
158+ " TOKEN_TYPE_CLAIM" : " token_type" ,
159+ }
0 commit comments