Commit 1e8db6e1 authored by Jon Yu's avatar Jon Yu
Browse files

Include dj-database-url, instructions

parent 043409ce
Pipeline #17198 passed with stage
in 14 seconds
...@@ -67,6 +67,18 @@ If using compose, you can run: ...@@ -67,6 +67,18 @@ If using compose, you can run:
docker-compose exec app pip freeze > requirements.prod.txt docker-compose exec app pip freeze > requirements.prod.txt
``` ```
### Update settings.DATABASES
Use the appropriate database connection strings to set your databases. This template uses dj-database-url, so you will just need to set `DATABASE_URL` in your environment.
See [here](https://github.com/jacobian/dj-database-url#url-schema) for additional connection string formats.
If multiple databases are required, you can add to the DATABASES dict:
```python
'alternate_db': dj_database_url.parse(os.getenv('ALTERNATE_DB_CONN_STRING')),
```
### (Optional) Update settings for Django error emails ### (Optional) Update settings for Django error emails
Set the following environment variables: Set the following environment variables:
......
asgiref==3.2.7 asgiref==3.2.7
certifi==2019.11.28 certifi==2019.11.28
cffi==1.14.0 cffi==1.14.0
chardet==3.0.4 chardet==3.0.4
cryptography==2.8 cryptography==2.8
Django==3.0.4 dj-database-url==0.5.0
gunicorn==20.0.4 Django==3.0.4
idna==2.9 gunicorn==20.0.4
josepy==1.3.0 idna==2.9
mozilla-django-oidc==1.2.3 josepy==1.3.0
pycparser==2.20 mozilla-django-oidc==1.2.3
pyOpenSSL==19.1.0 pycparser==2.20
pytz==2019.3 pyOpenSSL==19.1.0
requests==2.23.0 pytz==2019.3
six==1.14.0 requests==2.23.0
sqlparse==0.3.1 six==1.14.0
urllib3==1.25.8 sqlparse==0.3.1
whitenoise==5.0.1 urllib3==1.25.8
\ No newline at end of file whitenoise==5.0.1
Django~=3.0.4 Django~=3.0.4
whitenoise~=5.0.1 whitenoise~=5.0.1
gunicorn~=20.0.4 gunicorn~=20.0.4
mozilla-django-oidc~=1.2.3 mozilla-django-oidc~=1.2.3
\ No newline at end of file dj-database-url~=0.5.0
\ No newline at end of file
...@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ ...@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
""" """
import os import os
import dj_database_url
def str_to_bool(val): def str_to_bool(val):
return val.lower() in ('yes', 'true', 'on', '1') return val.lower() in ('yes', 'true', 'on', '1')
...@@ -145,10 +146,7 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ...@@ -145,10 +146,7 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { 'default': dj_database_url.config(default='sqlite:///db.sqlite3')
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
} }
......
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