-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
112 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
SECRET_KEY=blahblah | ||
DJANGO_SETTINGS_MODULE=findthatcharity.settings | ||
|
||
DATABASE_URL=postgres://postgres:postgres@localhost/ftc_dj | ||
CACHE_URL=dbcache://findthatcharity_cache | ||
DATABASE_ADMIN_URL=postgres://postgres:postgres@localhost/ftc_admin | ||
DATABASE_DASHBOARD_URL=postgres://postgres:postgres@localhost/ftc_dj | ||
DATASTORE_360GIVING_URL=postgres://postgres:postgres@localhost/360givingdatastore | ||
|
||
ES_URL=localhost:9200 | ||
ALLOWED_HOSTS='.ftc.dkane.net;.findthatcharity.uk' | ||
DEBUG=False | ||
|
||
EMAIL_HOST=smtp.example.com | ||
EMAIL_PORT=465 | ||
EMAIL_USE_SSL=True | ||
EMAIL_HOST_USER=[email protected] | ||
EMAIL_HOST_PASSWORD=blahblah | ||
ADMIN_EMAIL=[email protected] | ||
DEFAULT_FROM_EMAIL=[email protected] | ||
|
||
TWITTER_ACCESS_TOKEN=blahblah | ||
TWITTER_ACCESS_TOKEN_SECRET=blahblah | ||
TWITTER_CONSUMER_KEY=blahblah | ||
TWITTER_CONSUMER_SECRET=blahblah | ||
TWITTER_CONSUMER_SECRET=blahblah | ||
|
||
SENTRY_DSN=https://<id>@<id>.ingest.sentry.io/<code> | ||
LOGGING_DB=logs/logs_{year}_{month:02}.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
web: gunicorn findthatcharity.wsgi:application --timeout 120 | ||
release: python manage.py migrate --noinput | ||
release: sh ./release.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class DBRouter: | ||
""" | ||
A router to decide whether the data or admin database should be used. | ||
""" | ||
|
||
route_app_labels = { | ||
"addtocsv", | ||
"api", | ||
"charity", | ||
"companies", | ||
"ftcbot", | ||
"ftc", | ||
"geo", | ||
"other_data", | ||
"reconcile", | ||
} | ||
admin_db = "admin" | ||
data_db = "data" | ||
|
||
def db_for_read(self, model, **hints): | ||
""" | ||
Attempts to read data types go to data_db. | ||
""" | ||
if model._meta.app_label in self.route_app_labels: | ||
return self.data_db | ||
return self.admin_db | ||
|
||
def db_for_write(self, model, **hints): | ||
""" | ||
Attempts to write data types go to data_db. | ||
""" | ||
if model._meta.app_label in self.route_app_labels: | ||
return self.data_db | ||
return self.admin_db | ||
|
||
def allow_relation(self, obj1, obj2, **hints): | ||
""" | ||
Only allow relations in the same database | ||
""" | ||
return None | ||
|
||
def allow_migrate(self, db, app_label, model_name=None, **hints): | ||
""" | ||
Make sure the auth and contenttypes apps only appear in the | ||
'auth_db' database. | ||
""" | ||
if app_label in self.route_app_labels: | ||
return db == self.data_db | ||
return db == self.admin_db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
python manage.py migrate --database=data --noinput | ||
python manage.py migrate --database=admin --noinput |