settings.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. """
  2. Django settings for testthree 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 = 'u5!o3szyjs=vxm(%vb)6qj73nfw9!_l7ed@%9(h10b#m=k8gku'
  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. 'mptt',
  24. 'django.contrib.contenttypes',
  25. 'django.contrib.sessions',
  26. 'django.contrib.messages',
  27. 'django.contrib.staticfiles',
  28. 'rest_framework',
  29. 'django_filters',
  30. 'workreport',
  31. 'detailmptt',
  32. 'relation',
  33. 'pivottable',
  34. 'power'
  35. ]
  36. MIDDLEWARE = [
  37. 'django.middleware.security.SecurityMiddleware',
  38. 'django.contrib.sessions.middleware.SessionMiddleware',
  39. 'django.middleware.common.CommonMiddleware',
  40. 'django.middleware.csrf.CsrfViewMiddleware',
  41. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  42. 'django.contrib.messages.middleware.MessageMiddleware',
  43. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  44. ]
  45. ROOT_URLCONF = 'testthree.urls'
  46. TEMPLATES = [
  47. {
  48. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  49. 'DIRS': [],
  50. 'APP_DIRS': True,
  51. 'OPTIONS': {
  52. 'context_processors': [
  53. 'django.template.context_processors.debug',
  54. 'django.template.context_processors.request',
  55. 'django.contrib.auth.context_processors.auth',
  56. 'django.contrib.messages.context_processors.messages',
  57. ],
  58. },
  59. },
  60. ]
  61. WSGI_APPLICATION = 'testthree.wsgi.application'
  62. # Database
  63. # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  64. DATABASES = {
  65. 'default': {
  66. 'ENGINE': 'django.db.backends.mysql',
  67. 'NAME': "lvsh_django",
  68. 'USER': 'root',
  69. 'PASSWORD': 'abc.123',
  70. 'HOST': 'www.test.linkerplus.com',
  71. 'PORT': '3310'
  72. }
  73. }
  74. # Password validation
  75. # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
  76. AUTH_PASSWORD_VALIDATORS = [
  77. {
  78. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  79. },
  80. {
  81. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  82. },
  83. {
  84. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  85. },
  86. {
  87. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  88. },
  89. ]
  90. # Internationalization
  91. # https://docs.djangoproject.com/en/3.0/topics/i18n/
  92. LANGUAGE_CODE = 'en-us'
  93. TIME_ZONE = 'UTC'
  94. USE_I18N = True
  95. USE_L10N = True
  96. USE_TZ = True
  97. # Static files (CSS, JavaScript, Images)
  98. # https://docs.djangoproject.com/en/3.0/howto/static-files/
  99. STATIC_URL = '/static/'
  100. REST_FRAMEWORK = {
  101. 'DEFAULT_AUTHENTICATION_CLASSES': (
  102. 'rest_framework.authentication.BasicAuthentication',
  103. 'rest_framework.authentication.SessionAuthentication'
  104. ),
  105. 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
  106. 'PAGE_SIZE': 10,
  107. 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
  108. 'DEFAULT_PERMISSION_CLASSES': [
  109. 'rest_framework.permissions.IsAuthenticated'
  110. ]
  111. }
  112. AUTHENTICATION_BACKENDS = (
  113. 'django.contrib.auth.backends.ModelBackend'
  114. )