Skip to content

Commit f295bf3

Browse files
authored
Add customisation for the rock and charm (#14)
* Added app changes from the charmed version * Removed one level of nesting * Added initial details in README * Slightly reorganised README
1 parent b9fb8d3 commit f295bf3

File tree

4 files changed

+176
-3
lines changed

4 files changed

+176
-3
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Dashboard
22

3-
A Django-based database-driven web application, to track progress of projects against a set of criteria to measure quality and progress. [Run the application from source](./dashboard#readme)
3+
A Django-based database-driven web application, to track progress of projects against a set of criteria to measure quality and progress.
44

55
![A sample dashboard](screenshots/dashboard.png)
6+
7+
This repo contains the source code of the application. [Run the application from source](./dashboard#readme)
8+
9+
This repo also contains the source code of a Kubernetes charm for operating the application as part of a Juju deployment.
10+
To learn about Juju and charms, see https://juju.is/docs.
11+
12+
> [!IMPORTANT]
13+
> To use the dashboard charm in a real Juju deployment, see [TODO: docs on Charmhub] instead of this repo.
14+
> This repo is the right place to look if you'd like to test the charm, customise it for your own purposes, or contribute to development!
15+
16+
17+
## Deploy the charm on your machine
18+
19+
Work in progress. Aspects to cover:
20+
- Minimal steps to get the application running from scratch
21+
- Set up Juju and craft tools, pack rock, pack charm, deploy charm.
22+
Before packing the rock, run:
23+
```
24+
cp dashboard_rock_patch/dashboard/settings.py dashboard/dashboard/settings.py
25+
```
26+
- Integrate the PostgreSQL charm
27+
- Configure charm to work without ingress, in debug mode
28+
- Open the dashboard in your browser
29+
- Load sample data
30+
31+
32+
## Simulate a production deployment
33+
34+
Work in progress. Aspects to cover:
35+
- Integrating ingress
36+
- How to disable debug mode and still have the application work
37+
- Probably more...

dashboard/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Django==5.1.5
22
PyYAML==6.0.2
33
pytest==8.3.4
4-
pytest-django==4.10.0
54
docutils==0.21.2
65
whitenoise==6.9.0
76
psycopg2-binary==2.9.10
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
"""
2+
Django settings for dashboard project.
3+
4+
Generated by 'django-admin startproject' using Django 4.2.1.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/4.2/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
import json
16+
import os
17+
import secrets
18+
19+
20+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
21+
BASE_DIR = Path(__file__).resolve().parent.parent
22+
23+
24+
# Quick-start development settings - unsuitable for production
25+
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
26+
27+
# SECURITY WARNING: keep the secret key used in production secret!
28+
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', secrets.token_hex(32))
29+
30+
# SECURITY WARNING: don't run with debug turned on in production!
31+
32+
DEBUG = os.environ.get('DJANGO_DEBUG', 'false') == 'true'
33+
34+
ALLOWED_HOSTS = json.loads(os.environ.get('DJANGO_ALLOWED_HOSTS', '[]'))
35+
36+
37+
38+
# Application definition
39+
40+
INSTALLED_APPS = [
41+
"whitenoise.runserver_nostatic",
42+
"projects",
43+
"framework",
44+
"dashboard",
45+
"django.contrib.admin",
46+
"django.contrib.admindocs",
47+
"django.contrib.auth",
48+
"django.contrib.contenttypes",
49+
"django.contrib.sessions",
50+
"django.contrib.messages",
51+
"django.contrib.staticfiles",
52+
]
53+
54+
MIDDLEWARE = [
55+
"django.middleware.security.SecurityMiddleware",
56+
"django.contrib.sessions.middleware.SessionMiddleware",
57+
"whitenoise.middleware.WhiteNoiseMiddleware",
58+
"django.middleware.common.CommonMiddleware",
59+
"django.middleware.csrf.CsrfViewMiddleware",
60+
"django.contrib.auth.middleware.AuthenticationMiddleware",
61+
"django.contrib.messages.middleware.MessageMiddleware",
62+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
63+
"django.contrib.admindocs.middleware.XViewMiddleware",
64+
]
65+
66+
ROOT_URLCONF = "dashboard.urls"
67+
68+
TEMPLATES = [
69+
{
70+
"BACKEND": "django.template.backends.django.DjangoTemplates",
71+
"DIRS": [BASE_DIR / "templates"],
72+
"APP_DIRS": True,
73+
"OPTIONS": {
74+
"context_processors": [
75+
"django.template.context_processors.debug",
76+
"django.template.context_processors.request",
77+
"django.contrib.auth.context_processors.auth",
78+
"django.contrib.messages.context_processors.messages",
79+
],
80+
},
81+
},
82+
]
83+
84+
WSGI_APPLICATION = "dashboard.wsgi.application"
85+
86+
87+
# Database
88+
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
89+
90+
DATABASES = {
91+
"default": {
92+
'ENGINE': 'django.db.backends.postgresql',
93+
'NAME': os.environ.get('POSTGRESQL_DB_NAME'),
94+
'USER': os.environ.get('POSTGRESQL_DB_USERNAME'),
95+
'PASSWORD': os.environ.get('POSTGRESQL_DB_PASSWORD'),
96+
'HOST': os.environ.get('POSTGRESQL_DB_HOSTNAME'),
97+
'PORT': os.environ.get('POSTGRESQL_DB_PORT'),
98+
}
99+
}
100+
101+
102+
# Password validation
103+
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
104+
105+
AUTH_PASSWORD_VALIDATORS = [
106+
{
107+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
108+
},
109+
{
110+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
111+
},
112+
{
113+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
114+
},
115+
{
116+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
117+
},
118+
]
119+
120+
121+
# Internationalization
122+
# https://docs.djangoproject.com/en/4.2/topics/i18n/
123+
124+
LANGUAGE_CODE = "en-gb"
125+
126+
TIME_ZONE = "UTC"
127+
128+
USE_I18N = True
129+
130+
USE_TZ = True
131+
132+
133+
# Static files (CSS, JavaScript, Images)
134+
# https://docs.djangoproject.com/en/4.2/howto/static-files/
135+
136+
STATIC_URL = "static/"
137+
STATIC_ROOT = BASE_DIR / "staticfiles"
138+
139+
# Default primary key field type
140+
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
141+
142+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

rockcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: dashboard
22
# see https://documentation.ubuntu.com/rockcraft/en/1.8.0/explanation/bases/
33
# for more information about bases and using 'bare' bases for chiselled rocks
44
base: ubuntu@22.04 # the base environment for this Django application
5-
version: "0.5" # just for humans. Semantic versioning is recommended
5+
version: "0.6" # just for humans. Semantic versioning is recommended
66
summary: A summary of your Django application # 79 char long summary
77
description: |
88
Dashboard is a Django application to track quality and progress of multiple

0 commit comments

Comments
 (0)