update setting and urls

add code to __init__.py by pymysql_db
scl-branch
bettleChen 1 year ago
parent 44f3bff688
commit 10419fc804

@ -0,0 +1,2 @@
import pymysql
pymysql.install_as_MySQLdb()

@ -25,7 +25,7 @@ SECRET_KEY = 'q63j-o65lzp68yb$%gxz!w@74r@9xubd(66e_@+cfk$ornl(*%'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = ["*"]
# Application definition # Application definition
@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'API'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -75,8 +76,12 @@ WSGI_APPLICATION = 'EduSystemServer.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.mysql',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 'NAME': "edu_sys",
'USER': "root",
'PASSWORD': "cyh0110",
'HOST': "localhost",
'PORT': 3306,
} }
} }
@ -103,15 +108,15 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/ # https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'zh-Hans'
TIME_ZONE = 'UTC' TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True USE_I18N = True
USE_L10N = True USE_L10N = True
USE_TZ = True USE_TZ = False
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)

@ -14,8 +14,11 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, include
import API.urls
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('api/', include(("API.urls", "api"), namespace="api")),
] ]

Loading…
Cancel
Save