diff --git a/representatives/migrations/0005_auto_20240626_1411.py b/representatives/migrations/0005_auto_20240626_1411.py new file mode 100644 index 0000000..1f19fc3 --- /dev/null +++ b/representatives/migrations/0005_auto_20240626_1411.py @@ -0,0 +1,58 @@ +# Generated by Django 3.2.25 on 2024-06-26 14:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('representatives', '0004_switch_to_django_jsonfield'), + ] + + operations = [ + migrations.AlterField( + model_name='candidate', + name='extra', + field=models.JSONField(default=dict), + ), + migrations.AlterField( + model_name='candidate', + name='incumbent', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='candidate', + name='offices', + field=models.JSONField(default=list), + ), + migrations.AlterField( + model_name='election', + name='enabled', + field=models.BooleanField(blank=True, db_index=True, default=True), + ), + migrations.AlterField( + model_name='election', + name='last_import_successful', + field=models.BooleanField(blank=True, null=True), + ), + migrations.AlterField( + model_name='representative', + name='extra', + field=models.JSONField(default=dict), + ), + migrations.AlterField( + model_name='representative', + name='offices', + field=models.JSONField(default=list), + ), + migrations.AlterField( + model_name='representativeset', + name='enabled', + field=models.BooleanField(blank=True, db_index=True, default=True), + ), + migrations.AlterField( + model_name='representativeset', + name='last_import_successful', + field=models.BooleanField(blank=True, null=True), + ), + ] diff --git a/settings.py b/settings.py index b1e770c..6fedd2d 100644 --- a/settings.py +++ b/settings.py @@ -1,13 +1,20 @@ """ -To run `PYTHONPATH=$PYTHONPATH:$PWD django-admin.py migrate --settings settings --noinput`. +To run: env PYTHONPATH=$PWD DJANGO_SETTINGS_MODULE=settings django-admin migrate --noinput """ +import os + +ci = os.getenv('CI', False) SECRET_KEY = 'x' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'travis_ci_test', + 'HOST': 'localhost', + 'NAME': 'postgres' if ci else 'represent', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', + 'PORT': os.getenv('PORT', 5432), } } @@ -16,5 +23,35 @@ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.gis', + 'django.contrib.messages', 'representatives', ) + +MIDDLEWARE = [ + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +] + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +if 'GDAL_LIBRARY_PATH' in os.environ: + GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH') +if 'GEOS_LIBRARY_PATH' in os.environ: + GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')