settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. 'corsheaders',
  32. ]
  33. MIDDLEWARE = [
  34. 'django.middleware.security.SecurityMiddleware',
  35. 'django.contrib.sessions.middleware.SessionMiddleware',
  36. 'corsheaders.middleware.CorsMiddleware',
  37. 'django.middleware.common.CommonMiddleware',
  38. 'django.middleware.csrf.CsrfViewMiddleware',
  39. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  40. 'django.contrib.messages.middleware.MessageMiddleware',
  41. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  42. ]
  43. CORS_ORIGIN_ALLOW_ALL = True
  44. REST_FRAMEWORK = {
  45. # 'DEFAULT_PERMISSION_CLASSES': [
  46. # 'rest_framework.permissions.IsAdminUser',
  47. # ],
  48. 'PAGE_SIZE': 10
  49. }
  50. ROOT_URLCONF = 'todo.urls'
  51. TEMPLATES = [
  52. {
  53. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  54. 'DIRS': [],
  55. 'APP_DIRS': True,
  56. 'OPTIONS': {
  57. 'context_processors': [
  58. 'django.template.context_processors.debug',
  59. 'django.template.context_processors.request',
  60. 'django.contrib.auth.context_processors.auth',
  61. 'django.contrib.messages.context_processors.messages',
  62. ],
  63. },
  64. },
  65. ]
  66. WSGI_APPLICATION = 'todo.wsgi.application'
  67. # Database
  68. # https://docs.djangoproject.com/en/1.10/ref/settings/#databases
  69. DATABASES = {
  70. # 'default': {
  71. # 'ENGINE': 'django.db.backends.sqlite3',
  72. # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  73. # }
  74. 'default': {
  75. 'ENGINE': 'django.db.backends.mysql',
  76. 'NAME': 'todo1',
  77. 'USER': 'root',
  78. 'PASSWORD': 'abc.123',
  79. 'HOST': '192.168.1.7',
  80. 'PORT': '32769',
  81. }
  82. }
  83. # Password validation
  84. # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
  85. AUTH_PASSWORD_VALIDATORS = [
  86. {
  87. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  88. },
  89. {
  90. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  91. },
  92. {
  93. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  94. },
  95. {
  96. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  97. },
  98. ]
  99. # Internationalization
  100. # https://docs.djangoproject.com/en/1.10/topics/i18n/
  101. LANGUAGE_CODE = 'en-us'
  102. TIME_ZONE = 'UTC'
  103. USE_I18N = True
  104. USE_L10N = True
  105. USE_TZ = True
  106. # Static files (CSS, JavaScript, Images)
  107. # https://docs.djangoproject.com/en/1.10/howto/static-files/
  108. STATIC_URL = '/static/'