aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMitch Riedstra <Mitch@riedstra.us>2017-11-06 16:05:53 -0500
committerMitch Riedstra <Mitch@riedstra.us>2017-11-06 16:05:53 -0500
commitf5c84efd37085695732803b28d4a74cc05042e0e (patch)
tree5799c7bb6db8797027a449aa9a6943752ccee2b3 /app
parentecbc2c4751408c82c099dda0adf8b1c85b8ae3d9 (diff)
downloaddispatch-tracker-f5c84efd37085695732803b28d4a74cc05042e0e.tar.gz
dispatch-tracker-f5c84efd37085695732803b28d4a74cc05042e0e.tar.xz
Rename config to config-example and allow it to be loaded if config does not exist. Define email settings in config. Remove Django admin from the Admin's Nav.
Diffstat (limited to 'app')
-rw-r--r--app/.gitignore1
-rw-r--r--app/app/settings.py14
-rw-r--r--app/config-example.yml (renamed from app/config.yml)30
-rw-r--r--app/dispatch/templates/dispatch/nav.html1
4 files changed, 34 insertions, 12 deletions
diff --git a/app/.gitignore b/app/.gitignore
index f543301..70e8d3e 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -2,3 +2,4 @@ db.sqlite3*
media
tmux.sh
.ropeproject
+config.yml
diff --git a/app/app/settings.py b/app/app/settings.py
index f24a6b3..7e41f74 100644
--- a/app/app/settings.py
+++ b/app/app/settings.py
@@ -18,7 +18,11 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def get_default_config():
- return yaml.load(open(BASE_DIR + '/config.yml').read())
+ if os.path.exists(BASE_DIR + '/config.yml'):
+ return yaml.load(open(BASE_DIR + '/config.yml').read())
+ else:
+ print("Warning: loading example config! Create config.yml Soon!")
+ return yaml.load(open(BASE_DIR + '/config-example.yml').read())
CONFIG = {}
@@ -47,6 +51,14 @@ ALLOWED_HOSTS = CONFIG['allowed_hosts']
ADMINS = CONFIG['admins']
+if CONFIG.get('SET_EMAIL'):
+ EMAIL_HOST = CONFIG['EMAIL_HOST']
+ EMAIL_HOST_PASSWORD = CONFIG['EMAIL_HOST_PASSWORD']
+ EMAIL_HOST_USER = CONFIG['EMAIL_HOST_USER']
+ EMAIL_PORT = CONFIG['EMAIL_PORT']
+ EMAIL_USE_TLS = CONFIG['EMAIL_USE_TLS']
+
+
AUTH_USER_MODEL = 'dispatchAuth.User'
diff --git a/app/config.yml b/app/config-example.yml
index 8c39278..7954e08 100644
--- a/app/config.yml
+++ b/app/config-example.yml
@@ -1,12 +1,12 @@
---
# Postgres Example
-db_default:
- ENGINE: django.db.backends.postgresql
- NAME: dispatch
- USER: postgres
- PASSWORD:
- HOST: 127.0.0.1
- PORT: 5432
+# db_default:
+# ENGINE: django.db.backends.postgresql
+# NAME: dispatch
+# USER: postgres
+# PASSWORD:
+# HOST: 127.0.0.1
+# PORT: 5432
# MySQL Example
# db_default:
# ENGINE: django.db.backends.mysql
@@ -16,9 +16,9 @@ db_default:
# HOST: 127.0.0.1
# PORT: 3306
# Sqlite example. Full path is recommended
-# db_default:
-# ENGINE: django.db.backends.sqlite3
-# NAME: /home/mitch/scm/dispatch-tracker/app/db.sqlite3
+db_default:
+ ENGINE: django.db.backends.sqlite3
+ NAME: /home/mitch/scm/dispatch-tracker/app/db.sqlite3
allowed_hosts:
- localhost
@@ -35,3 +35,13 @@ SECRET_KEY: 'h$r_bwlp@#h#y#%&qhw-n=gb2%wva1d_h65+o94u&!a#%iv&lo'
admins:
- 'bob@example.com'
+
+
+# Email settings won't be loaded from this file if this is false
+SET_EMAIL: False
+# Email settings, edit for your needs
+EMAIL_HOST: smtp.example.com
+EMAIL_HOST_PASSWORD: p@$$w0rd9876543210
+EMAIL_HOST_USER: django@example.com
+EMAIL_PORT: 2525
+EMAIL_USE_TLS: True
diff --git a/app/dispatch/templates/dispatch/nav.html b/app/dispatch/templates/dispatch/nav.html
index 39acb38..a5f09e5 100644
--- a/app/dispatch/templates/dispatch/nav.html
+++ b/app/dispatch/templates/dispatch/nav.html
@@ -4,7 +4,6 @@
{% if request.user.is_superuser %}
<li><a href="{% url 'driver_list' %}">Drivers</a></li>
<li><a href="{% url 'customer_list' %}">Customers</a></li>
- <li><a href="/admin">DjangoAdmin</a></li>
{% else %}
<li><a href="{% url 'driver_summary' request.user.id %}">Summary</a>
<li><a href="{% url 'driver_details' request.user.id %}">My Account</a></li>