Commit 0bd9e607 authored by Patrick Kimber's avatar Patrick Kimber

Kubernetes (k3d) environment variables ('.env.fish') +requirements

parent e789c841
# Set environment variables for this VE
source venv-invoice/bin/activate.fish
set -x DATABASE_HOST ""
set -x DATABASE_PASS ""
set -x DATABASE_USER ""
set -x KUBECONFIG (k3d get-kubeconfig)
set -x DATABASE_HOST (kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
set -x DATABASE_NAME "dev_test_invoice_app_$USER"
set -x DATABASE_PASS "postgres"
set -x DATABASE_PORT (kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services kb-dev-db-postgresql)
set -x DATABASE_USER "postgres"
set -x DEFAULT_FROM_EMAIL "web@pkimber.net"
set -x DJANGO_SETTINGS_MODULE "example_invoice.dev_patrick"
set -x MAIL_TEMPLATE_TYPE "django"
......@@ -12,3 +15,8 @@ set -x SECRET_KEY "the_secret_key"
set -x STRIPE_PUBLISH_KEY "your_stripe_publish_key"
set -x STRIPE_SECRET_KEY "your_stripe_secret_key"
source .private
echo "KUBECONFIG:" $KUBECONFIG
echo "DATABASE_NAME:" $DATABASE_NAME
echo "DATABASE_HOST:" $DATABASE_HOST
echo "DATABASE_PORT:" $DATABASE_PORT
......@@ -4,11 +4,26 @@ from .base import *
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "temp.db",
"USER": "",
"PASSWORD": "",
"HOST": "",
"PORT": "",
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": get_env_variable("DATABASE_NAME"),
"USER": get_env_variable("DATABASE_USER"),
"PASSWORD": get_env_variable("DATABASE_PASS"),
"HOST": get_env_variable("DATABASE_HOST"),
"PORT": get_env_variable("DATABASE_PORT"),
}
}
MIDDLEWARE += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
INSTALLED_APPS += ("django_extensions", "debug_toolbar")
# force the debug toolbar to be displayed
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar,
"INTERCEPT_REDIRECTS": False,
"ENABLE_STACKTRACES": True,
}
......@@ -5,11 +5,11 @@ from example_invoice.base import *
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "dev_test_invoice",
"NAME": "dev_test_app_invoice",
"USER": get_env_variable("DATABASE_USER"),
"PASSWORD": get_env_variable("DATABASE_PASS"),
"HOST": get_env_variable("DATABASE_HOST"),
"PORT": "",
"PORT": get_env_variable("DATABASE_PORT"),
}
}
......
# -*- encoding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
......@@ -57,3 +58,10 @@ urlpatterns = [
]
urlpatterns += staticfiles_urlpatterns()
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r"^__debug__/", include(debug_toolbar.urls))
] + urlpatterns
......@@ -14,6 +14,7 @@
-e ../search
-e ../stock
black
django-debug-toolbar
factory-boy
freezegun
GitPython
......
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