settings.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. """
  2. Django settings for todo project.
  3. Generated by 'django-admin startproject' using Django 1.10.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/1.10/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/1.10/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/1.10/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'o(0jhq4_pr0&l_$66-plvf+g6dnf^6@l6@lt8jf^4j&77bfprh'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = []
  19. import pymysql;
  20. pymysql.install_as_MySQLdb()
  21. # Application definition
  22. INSTALLED_APPS = [
  23. 'django.contrib.admin',
  24. 'django.contrib.auth',
  25. 'django.contrib.contenttypes',
  26. 'django.contrib.sessions',
  27. 'django.contrib.messages',
  28. 'django.contrib.staticfiles',
  29. 'api.task',
  30. 'rest_framework',
  31. ]
  32. MIDDLEWARE = [
  33. 'django.middleware.security.SecurityMiddleware',
  34. 'django.contrib.sessions.middleware.SessionMiddleware',
  35. 'django.middleware.common.CommonMiddleware',
  36. 'django.middleware.csrf.CsrfViewMiddleware',
  37. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  38. 'django.contrib.messages.middleware.MessageMiddleware',
  39. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  40. ]
  41. REST_FRAMEWORK = {
  42. # 'DEFAULT_PERMISSION_CLASSES': [
  43. # 'rest_framework.permissions.IsAdminUser',
  44. # ],
  45. 'PAGE_SIZE': 10
  46. }
  47. ROOT_URLCONF = 'todo.urls'
  48. TEMPLATES = [
  49. {
  50. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  51. 'DIRS': [],
  52. 'APP_DIRS': True,
  53. 'OPTIONS': {
  54. 'context_processors': [
  55. 'django.template.context_processors.debug',
  56. 'django.template.context_processors.request',
  57. 'django.contrib.auth.context_processors.auth',
  58. 'django.contrib.messages.context_processors.messages',
  59. ],
  60. },
  61. },
  62. ]
  63. WSGI_APPLICATION = 'todo.wsgi.application'
  64. # Database
  65. # https://docs.djangoproject.com/en/1.10/ref/settings/#databases
  66. DATABASES = {
  67. # 'default': {
  68. # 'ENGINE': 'django.db.backends.sqlite3',
  69. # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  70. # }
  71. 'default': {
  72. 'ENGINE': 'django.db.backends.mysql',
  73. 'NAME': 'todo1',
  74. 'USER': 'root',
  75. 'PASSWORD': 'abc.123',
  76. 'HOST': '192.168.1.7',
  77. 'PORT': '32769',
  78. }
  79. }
  80. # Password validation
  81. # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
  82. AUTH_PASSWORD_VALIDATORS = [
  83. {
  84. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  85. },
  86. {
  87. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  88. },
  89. {
  90. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  91. },
  92. {
  93. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  94. },
  95. ]
  96. # Internationalization
  97. # https://docs.djangoproject.com/en/1.10/topics/i18n/
  98. LANGUAGE_CODE = 'en-us'
  99. TIME_ZONE = 'UTC'
  100. USE_I18N = True
  101. USE_L10N = True
  102. USE_TZ = True
  103. # Static files (CSS, JavaScript, Images)
  104. # https://docs.djangoproject.com/en/1.10/howto/static-files/
  105. STATIC_URL = '/static/'