settings.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. """
  2. Django settings for Niko project.
  3. Generated by 'django-admin startproject' using Django 1.9.1.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/1.9/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/1.9/ref/settings/
  8. """
  9. import os
  10. import posixpath
  11. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  12. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = '3eab158c-8531-4c6b-800e-9181f6511a41'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. # ENVIRONMENT = 'PRODUCTION'
  20. PRODUCTION_ENVIRONMENT = False
  21. ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'www.pujianghui.work']
  22. # Application definition
  23. INSTALLED_APPS = [
  24. # Add your apps here to enable them
  25. 'django.contrib.admin',
  26. 'django.contrib.auth',
  27. 'django.contrib.contenttypes',
  28. 'django.contrib.sessions',
  29. 'django.contrib.messages',
  30. 'django.contrib.staticfiles',
  31. 'checkIn',
  32. 'dati',
  33. 'library',
  34. 'captcha',
  35. 'volunteer_arrangement',
  36. 'backend',
  37. ]
  38. MIDDLEWARE_CLASSES = [
  39. 'django.middleware.security.SecurityMiddleware',
  40. 'django.contrib.sessions.middleware.SessionMiddleware',
  41. 'django.middleware.common.CommonMiddleware',
  42. 'django.middleware.csrf.CsrfViewMiddleware',
  43. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  44. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  45. 'django.contrib.messages.middleware.MessageMiddleware',
  46. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  47. ]
  48. ROOT_URLCONF = 'Niko.urls'
  49. TEMPLATES = [
  50. {
  51. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  52. 'DIRS': [],
  53. 'APP_DIRS': True,
  54. 'OPTIONS': {
  55. 'context_processors': [
  56. 'django.template.context_processors.debug',
  57. 'django.template.context_processors.request',
  58. 'django.contrib.auth.context_processors.auth',
  59. 'django.contrib.messages.context_processors.messages',
  60. 'django.template.context_processors.media'
  61. ],
  62. },
  63. },
  64. ]
  65. WSGI_APPLICATION = 'Niko.wsgi.application'
  66. # Database
  67. # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
  68. DATABASES = {
  69. # 使用sqlite3
  70. 'default': {
  71. 'ENGINE': 'django.db.backends.sqlite3',
  72. 'NAME': os.path.join(BASE_DIR, 'APP_data/db.sqlite3'),
  73. },
  74. # 使用mysql,需要pip install mysqlclient。手机号码需要设置为BIGINT
  75. # 'default': {
  76. # "ENGINE": "django.db.backends.mysql",
  77. # "NAME": "nico_db",
  78. # "USER": "nico",
  79. # "PASSWORD": "qwer1234TYUI%^&*",
  80. # "HOST": "localhost",
  81. # "PORT": "3306",
  82. # },
  83. }
  84. # Password validation
  85. # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
  86. AUTH_PASSWORD_VALIDATORS = [
  87. {
  88. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  89. },
  90. {
  91. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  92. },
  93. {
  94. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  95. },
  96. {
  97. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  98. },
  99. ]
  100. # Internationalization
  101. # https://docs.djangoproject.com/en/1.9/topics/i18n/
  102. LANGUAGE_CODE = 'zh-Hans'
  103. TIME_ZONE = 'Asia/Shanghai'
  104. USE_I18N = True
  105. USE_L10N = True
  106. USE_TZ = True
  107. # Static files (CSS, JavaScript, Images)
  108. # https://docs.djangoproject.com/en/1.9/howto/static-files/
  109. STATIC_URL = '/static/'
  110. STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
  111. MEDIA_URL = '/static/media/'
  112. MEDIA_STORAGE = 'static\\media'
  113. MEDIA_ROOT = os.path.join(BASE_DIR, "static/media")
  114. # MEDIA_ROOT = 'C:\\www_static\\elephant_bus\\media'
  115. CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
  116. CAPTCHA_LETTER_ROTATION = (-10, 10)
  117. CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
  118. CACHES = {
  119. 'default': {
  120. 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
  121. }
  122. }
  123. CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
  124. CAPTCHA_MATH_CHALLENGE_OPERATOR = 'x'