From 8403fb89eaf0ae4b77bf73de51c866a5f01c6aff Mon Sep 17 00:00:00 2001 From: Czw <459749926@qq.com> Date: Mon, 8 Nov 2021 17:40:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9D=83=E9=99=90,=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7,=20=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documents/常用命令.md | 8 ++++++++ project/settings.py | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/documents/常用命令.md b/documents/常用命令.md index e3d1a5f..ca63ecf 100644 --- a/documents/常用命令.md +++ b/documents/常用命令.md @@ -8,6 +8,14 @@ http://127.0.0.1:8000/api/schema/redoc/ http://127.0.0.1:8000/api/ ``` +## 构建 + +``` +python manage.py makemigrations +python manage.py migrate +python manage.py shell_plus +``` + ## 启动 ``` diff --git a/project/settings.py b/project/settings.py index 25fc7d2..1e0ac02 100644 --- a/project/settings.py +++ b/project/settings.py @@ -154,6 +154,17 @@ MEDIA_ROOT = BASE_DIR / 'media' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +# Django REST framework +# https://www.django-rest-framework.org/ + +REST_FRAMEWORK = { + 'DATETIME_FORMAT': "%Y-%m-%d %H:%M:%S", + 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], + 'DEFAULT_AUTHENTICATION_CLASSES': ['extensions.authentications.BaseAuthentication'], + 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', +} + + # Simple JWT # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/