dev.py.sample 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. from settings.common import *
  2. # for multi computer room deploy and use separate redis server
  3. DEPLOY_ZONE = ''
  4. MIDDLEWARE = [
  5. 'service.csrf_service.DisableCSRF',
  6. 'django.middleware.security.SecurityMiddleware',
  7. 'django.contrib.sessions.middleware.SessionMiddleware',
  8. 'django.middleware.common.CommonMiddleware',
  9. 'django.middleware.csrf.CsrfViewMiddleware',
  10. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  11. 'service.permission.api_permission.ApiPermissionCheck',
  12. 'django.contrib.messages.middleware.MessageMiddleware',
  13. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  14. ]
  15. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  16. MEDIA_URL = '/media/'
  17. # Database
  18. # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
  19. DATABASES = {
  20. 'default': {
  21. 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
  22. 'NAME': 'loonflownew', # Or path to database file if using sqlite3.
  23. 'USER': 'loonflownew', # Not used with sqlite3.
  24. 'PASSWORD': '123456', # Not used with sqlite3.
  25. 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
  26. 'PORT': '3306', # Set to empty string for default. Not used with sqlite3.
  27. }
  28. }
  29. REDIS_HOST = '127.0.0.1'
  30. REDIS_PORT = 6379
  31. REDIS_DB = 0
  32. REDIS_PASSWORD = ''
  33. if REDIS_PASSWORD:
  34. CELERY_BROKER_URL = 'redis://:{}@{}:{}/{}'.format(REDIS_PASSWORD, REDIS_HOST, REDIS_PORT, REDIS_DB)
  35. else:
  36. CELERY_BROKER_URL = 'redis://{}:{}/{}'.format(REDIS_HOST, REDIS_PORT, REDIS_DB)
  37. HOOK_HOST_ALLOWED = [] # host list that allow used as hook url, such as ['192,168.1.12', 'www.baidu.com'], if no this setting key means allow all
  38. LOGGING = {
  39. 'version': 1,
  40. 'disable_existing_loggers': False,
  41. 'filters': {
  42. 'require_debug_true': {
  43. '()': 'django.utils.log.RequireDebugTrue',
  44. },
  45. },
  46. 'formatters': {
  47. 'standard': {
  48. 'format': '%(asctime)s %(pathname)s process-%(process)d thread-%(thread)d %(lineno)d [%(levelname)s]: %(message)s',
  49. },
  50. },
  51. 'handlers': {
  52. 'file_handler': {
  53. 'level': 'DEBUG',
  54. 'class': 'logging.FileHandler',
  55. 'filename': HOMEPATH + '/loonflow.log',
  56. 'formatter': 'standard'
  57. },
  58. 'console': {
  59. 'level': 'DEBUG',
  60. 'filters': ['require_debug_true'],
  61. 'class': 'logging.StreamHandler',
  62. 'formatter': 'standard'
  63. },
  64. },
  65. 'loggers': {
  66. 'django': {
  67. 'handlers': ['file_handler'],
  68. 'propagate': True,
  69. 'level': 'INFO',
  70. },
  71. 'django.db.backends': {
  72. 'handlers': ['console'],
  73. 'propagate': True,
  74. 'level': 'INFO',
  75. }
  76. }
  77. }