Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Connection to PROD Db utilizing ENV variable #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
-DB_PORT=5432
-SECRET_KEY=YOUR-SECRET-KEY
-ALLOWED_HOSTS=.localhost, .herokuapp.com
-DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}
install:
- pip install -r requirements.txt
before_script:
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ cp .env.sample .env

Now edit .env fill the generated `.env` file with your credentials to run it locally.

## Database

For the Database to be used(in Production),
you can export the connection url in `DATABASE_URL`,
eg,
```sh
$ export DATABASE_URL=postgres://postgres:[email protected]:5432/test
```

## Running

```sh
Expand Down
10 changes: 1 addition & 9 deletions certificate_generator/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,9 @@
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config('DB_NAME'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': config('DB_HOST'),
'PORT': config('DB_PORT'),
}
'default': dj_database_url.config(default=config('DATABASE_URL'))
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

Expand Down