settings.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. """
  2. Django settings for PyCharmItems1 project.
  3. Generated by 'django-admin startproject' using Django 3.0.8.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/3.0/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/3.0/ref/settings/
  8. """
  9. import os
  10. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  11. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = '$=o$843^0xa2djpn9r6mqzn$%dzp=u#m@&&w=z_!q^%$gtw0$r'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = []
  19. # Application definition
  20. INSTALLED_APPS = [
  21. 'django.contrib.admin',
  22. 'django.contrib.auth',
  23. 'django.contrib.contenttypes',
  24. 'django.contrib.sessions',
  25. 'django.contrib.messages',
  26. 'django.contrib.staticfiles',
  27. 'rest_framework',
  28. 'django_filters',
  29. 'workreport',
  30. ]
  31. MIDDLEWARE = [
  32. 'django.middleware.security.SecurityMiddleware',
  33. 'django.contrib.sessions.middleware.SessionMiddleware',
  34. 'django.middleware.common.CommonMiddleware',
  35. 'django.middleware.csrf.CsrfViewMiddleware',
  36. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  37. 'django.contrib.messages.middleware.MessageMiddleware',
  38. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  39. ]
  40. ROOT_URLCONF = 'PyCharmItems1.urls'
  41. TEMPLATES = [
  42. {
  43. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  44. 'DIRS': [os.path.join(BASE_DIR, 'templates')]
  45. ,
  46. 'APP_DIRS': True,
  47. 'OPTIONS': {
  48. 'context_processors': [
  49. 'django.template.context_processors.debug',
  50. 'django.template.context_processors.request',
  51. 'django.contrib.auth.context_processors.auth',
  52. 'django.contrib.messages.context_processors.messages',
  53. ],
  54. },
  55. },
  56. ]
  57. WSGI_APPLICATION = 'PyCharmItems1.wsgi.application'
  58. # Database
  59. # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  60. DATABASES = {
  61. 'default': {
  62. 'ENGINE': 'django.db.backends.mysql',
  63. 'NAME': 'zhuangyp_django_demo',
  64. 'USER': 'root',
  65. 'PASSWORD': 'abc.123',
  66. 'HOST': 'srv.test.linkerplus.com',
  67. 'PORT': '3310'
  68. }
  69. }
  70. # Password validation
  71. # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
  72. AUTH_PASSWORD_VALIDATORS = [
  73. {
  74. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  75. },
  76. {
  77. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  78. },
  79. {
  80. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  81. },
  82. {
  83. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  84. },
  85. ]
  86. # Internationalization
  87. # https://docs.djangoproject.com/en/3.0/topics/i18n/
  88. LANGUAGE_CODE = 'en-us'
  89. TIME_ZONE = 'UTC'
  90. USE_I18N = True
  91. USE_L10N = True
  92. USE_TZ = True
  93. # Static files (CSS, JavaScript, Images)
  94. # https://docs.djangoproject.com/en/3.0/howto/static-files/
  95. STATIC_URL = '/static/'
  96. REST_FRAMEWORK = {
  97. 'DEFAULT_AUTHENTICATION_CLASSES': (
  98. 'rest_framework.authentication.BasicAuthentication',
  99. 'rest_framework.authentication.SessionAuthentication'
  100. ),
  101. 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
  102. 'PAGE_SIZE': 10,
  103. 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
  104. 'DEFAULT_PERMISSION_CLASSES': [
  105. 'rest_framework.permissions.IsAuthenticated',
  106. ]
  107. }
  108. # AUTHENTICATION_BACKENDS = (
  109. # 'django.contrib.auth.backends.ModelBackend',
  110. # )