Commit 677b112a authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Use pgsql on CI

parent f6a4020a
sudo: false sudo: false
env: env:
- DJANGO_DEBUG=True DJANGO_SETTINGS_MODULE=memopol.settings global:
- DJANGO_DEBUG=True
- DJANGO_SETTINGS_MODULE=memopol.settings
- MEMOPOL_DB_NAME=memopol
- MEMOPOL_DB_USER=memopol
- MEMOPOL_DB_PASSWORD=memopol
- MEMOPOL_DB_HOST=localhost
- MEMOPOL_DB_PORT=5432
- MEMOPOL_DB_ENGINE=django.db.backends.postgresql_psycopg2
language: python language: python
python: python:
- '2.7' - '2.7'
services:
- postgresql
install: install:
- pip install -e .[testing] - pip install -e .[testing]
before_script: before_script:
- bin/install_client_deps.sh - bin/install_client_deps.sh
- psql -c "CREATE USER memopol WITH CREATEDB PASSWORD 'memopol';" -U postgres
- psql -c "CREATE DATABASE memopol WITH OWNER memopol;" -U postgres
script: script:
- flake8 . --exclude '*/migrations,docs,static' --ignore E128 - flake8 . --exclude '*/migrations,docs,static' --ignore E128
- py.test memopol representatives_positions representatives_recommendations - py.test memopol representatives_positions representatives_recommendations
......
...@@ -125,20 +125,16 @@ WSGI_APPLICATION = 'memopol.wsgi.application' ...@@ -125,20 +125,16 @@ WSGI_APPLICATION = 'memopol.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'NAME': os.environ.get('DJANGO_DATABASE_DEFAULT_NAME', 'db.sqlite'), 'NAME': os.environ.get('MEMOPOL_DB_NAME', 'memopol'),
'USER': os.environ.get('DJANGO_DATABASE_DEFAULT_USER', ''), 'USER': os.environ.get('MEMOPOL_DB_USER', 'memopol'),
'PASSWORD': os.environ.get('DJANGO_DATABASE_DEFAULT_PASSWORD', ''), 'PASSWORD': os.environ.get('MEMOPOL_DB_PASSWORD', 'memopol'),
'HOST': os.environ.get('DJANGO_DATABASE_DEFAULT_HOST', ''), 'HOST': os.environ.get('MEMOPOL_DB_HOST', 'localhost'),
'PORT': os.environ.get('DJANGO_DATABASE_DEFAULT_PORT', ''), 'PORT': os.environ.get('MEMOPOL_DB_PORT', '5432'),
'ENGINE': os.environ.get('DJANGO_DATABASE_DEFAULT_ENGINE', 'ENGINE': os.environ.get('MEMOPOL_DB_ENGINE',
'django.db.backends.sqlite3'), 'django.db.backends.postgresql_psycopg2'),
} }
} }
if 'OPENSHIFT_DATA_DIR' in os.environ:
DATABASES['default']['NAME'] = os.path.join(DATA_DIR, 'db.sqlite')
if 'OPENSHIFT_POSTGRESQL_DB_HOST' in os.environ: if 'OPENSHIFT_POSTGRESQL_DB_HOST' in os.environ:
DATABASES['default']['NAME'] = os.environ['OPENSHIFT_APP_NAME'] DATABASES['default']['NAME'] = os.environ['OPENSHIFT_APP_NAME']
DATABASES['default']['USER'] = os.environ[ DATABASES['default']['USER'] = os.environ[
...@@ -147,7 +143,6 @@ if 'OPENSHIFT_POSTGRESQL_DB_HOST' in os.environ: ...@@ -147,7 +143,6 @@ if 'OPENSHIFT_POSTGRESQL_DB_HOST' in os.environ:
'OPENSHIFT_POSTGRESQL_DB_PASSWORD'] 'OPENSHIFT_POSTGRESQL_DB_PASSWORD']
DATABASES['default']['HOST'] = os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'] DATABASES['default']['HOST'] = os.environ['OPENSHIFT_POSTGRESQL_DB_HOST']
DATABASES['default']['PORT'] = os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'] DATABASES['default']['PORT'] = os.environ['OPENSHIFT_POSTGRESQL_DB_PORT']
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/ # https://docs.djangoproject.com/en/1.7/topics/i18n/
......
...@@ -28,6 +28,7 @@ setup(name='political-memory', ...@@ -28,6 +28,7 @@ setup(name='political-memory',
'pytz', # Always use up-to-date TZ data 'pytz', # Always use up-to-date TZ data
'django-suit>=0.2,<0.3', 'django-suit>=0.2,<0.3',
'sqlparse>=0.1,<0.2', 'sqlparse>=0.1,<0.2',
'psycopg2>=2,<3',
], ],
extras_require={ extras_require={
# Full version hardcode for testing dependencies so that # Full version hardcode for testing dependencies so that
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment