Skip to content

Commit

Permalink
Add pg db configurations and secure settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
dodget committed Sep 15, 2020
1 parent d3b6790 commit bd6d0c7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.sqlite3

.envrc
secure.py
8 changes: 8 additions & 0 deletions giza/secure.py.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SECURE_SETTINGS = {
"DB_HOST": "",
"DB_NAME": "",
"DB_USER": "",
"DB_PASSWORD": "",
"DB_PORT": "",
"DJANGO_SECRET_KEY": ""
}
10 changes: 8 additions & 2 deletions giza/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os
from .secure import SECURE_SETTINGS

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -89,11 +90,16 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': SECURE_SETTINGS.get('DB_NAME', 'giza'),
'USER': SECURE_SETTINGS.get('DB_USER', 'postgres'),
'PASSWORD': SECURE_SETTINGS.get('DB_PASSWORD'),
'HOST': SECURE_SETTINGS.get('DB_HOST', '127.0.0.1'),
'PORT': SECURE_SETTINGS.get('DB_PORT', 5432), # Default postgres port
}
}


SEARCH_BACKENDS = {
'default': {
'BACKEND': 'elasticsearch',
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==2.2.12
Django~=2.2.0
django-tinymce==2.8.0
elasticsearch==5.5.3
Pillow==7.1.1
Expand All @@ -7,5 +7,4 @@ pyodbc==4.0.30
pytz==2019.1
sqlparse==0.3.0
urllib3==1.25.8
pyodbc>=4.0.27
requests==2.22.0

0 comments on commit bd6d0c7

Please sign in to comment.