From 8ddd53438d80d6a3d01778eb38b61abab1f32360 Mon Sep 17 00:00:00 2001 From: giginet Date: Sat, 11 Feb 2017 23:43:30 +0900 Subject: [PATCH] Use MySQL on Travis CI --- .travis.yml | 1 + src/kawaz/ci_settings.py | 14 ++++++++++++++ src/kawaz/settings.py | 7 ++++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/kawaz/ci_settings.py diff --git a/.travis.yml b/.travis.yml index 47fb0d5d..7fd4e407 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: before_install: - ./utils/decrypt-files $password_for_secret_files - git submodule update --init --recursive + - mysql -uroot -e "create database test_kawaz_travis" install: - pip install tox - pip install coverage coveralls diff --git a/src/kawaz/ci_settings.py b/src/kawaz/ci_settings.py new file mode 100644 index 00000000..e3e98967 --- /dev/null +++ b/src/kawaz/ci_settings.py @@ -0,0 +1,14 @@ +# テスト用データーベースの設定 +DATABASES = { + 'TEST': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'test_kawaz_travis', + 'USER': 'root', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '', + 'OPTIONS': { + 'connect_timeout': 60, + }, + } +} diff --git a/src/kawaz/settings.py b/src/kawaz/settings.py index 30a063fd..dafdb53d 100644 --- a/src/kawaz/settings.py +++ b/src/kawaz/settings.py @@ -3,9 +3,12 @@ # Kawaz ポータルサイトの設定 # ############################################################################### +import os from .pre_settings import * from django.utils.translation import ugettext_lazy as _ +IS_CI = os.environ['CI'] and os.environ['TRAVIS'] + # セッション暗号化用文字列の指定 SECRET_KEY = 'ここに十分に長いランダムな文字列' @@ -324,6 +327,7 @@ # django-debug-toolbar def show_debug_toolbar(request): + return False from django.conf import settings if settings.TESTING: return False @@ -375,4 +379,5 @@ def show_debug_toolbar(request): try: from .local_settings import * except ImportError: - pass + if CI: + from .ci_settings import *