test.py.sample 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
  22. 'NAME': 'loonflow_test.db', # Or path to database file if using sqlite3.
  23. 'TEST_CHARSET': 'utf8',
  24. 'TEST_COLLATION': 'utf8_general_ci',
  25. }
  26. }
  27. REDIS_HOST = '127.0.0.1'
  28. REDIS_PORT = 6379
  29. REDIS_DB = 0
  30. REDIS_PASSWORD = ''
  31. if REDIS_PASSWORD:
  32. CELERY_BROKER_URL = 'redis://:{}@{}:{}/{}'.format(REDIS_PASSWORD, REDIS_HOST, REDIS_PORT, REDIS_DB)
  33. else:
  34. CELERY_BROKER_URL = 'redis://{}:{}/{}'.format(REDIS_HOST, REDIS_PORT, REDIS_DB)
  35. FIXTURE_DIRS = ('tests/fixtures/',)
  36. 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