Change workflow stuff, update Readme, update .env handling #15
@@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- pre-prod
|
- pre-prod
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -31,5 +31,8 @@ jobs:
|
|||||||
echo "Building containers..."
|
echo "Building containers..."
|
||||||
make prod
|
make prod
|
||||||
|
|
||||||
|
echo "Running Django deploy check"
|
||||||
|
docker compose run --rm web python manage.py check --deploy
|
||||||
|
|
||||||
echo "Deployment complete."
|
echo "Deployment complete."
|
||||||
EOF
|
EOF
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -175,3 +175,7 @@ cython_debug/
|
|||||||
# PyPI configuration file
|
# PyPI configuration file
|
||||||
.pypirc
|
.pypirc
|
||||||
|
|
||||||
|
# gunicon webserver
|
||||||
|
gunicorn.ctl
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -4,7 +4,8 @@ prod:
|
|||||||
|
|
||||||
dev:
|
dev:
|
||||||
docker compose down
|
docker compose down
|
||||||
docker compose -f ./compose.yaml -f ./compose.dev.yaml up --build
|
docker compose -f ./compose.yaml -f ./compose.dev.yaml up --build -d
|
||||||
|
docker exec -it quatsh-website-web-1 sh
|
||||||
|
|
||||||
test:
|
test:
|
||||||
docker compose --env-file .env.template -f ./compose.yaml -f ./compose.test.yaml up --build --abort-on-container-exit --exit-code-from web
|
docker compose --env-file .env.template -f ./compose.yaml -f ./compose.test.yaml up --build --abort-on-container-exit --exit-code-from web
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
## Requirements:
|
## Requirements:
|
||||||
|
|
||||||
### Install make
|
### Install make
|
||||||
Running this requires the use of "make" and docker.\
|
Running this requires the use of "make" and docker.
|
||||||
|
|
||||||
"make" tends to come pre-installed on linux but not on Windows, to install it on Windows I recommend using Chocolatey as follows: \
|
"make" tends to come pre-installed on linux but not on Windows, to install it on Windows I recommend using Chocolatey as follows: \
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ services:
|
|||||||
db:
|
db:
|
||||||
image: postgres:18
|
image: postgres:18
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: ${POSTGRES_DB}
|
POSTGRES_DB: ${POSTGRES_DBNAME}
|
||||||
POSTGRES_USER: ${POSTGRES_USER}
|
POSTGRES_USER: ${POSTGRES_USER}
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
0
src/polls/__init__.py
Normal file
0
src/polls/__init__.py
Normal file
3
src/polls/admin.py
Normal file
3
src/polls/admin.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
5
src/polls/apps.py
Normal file
5
src/polls/apps.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PollsConfig(AppConfig):
|
||||||
|
name = 'polls'
|
||||||
0
src/polls/migrations/__init__.py
Normal file
0
src/polls/migrations/__init__.py
Normal file
3
src/polls/models.py
Normal file
3
src/polls/models.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
3
src/polls/tests.py
Normal file
3
src/polls/tests.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
7
src/polls/urls.py
Normal file
7
src/polls/urls.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", views.index, name="index"),
|
||||||
|
]
|
||||||
9
src/polls/views.py
Normal file
9
src/polls/views.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
return HttpResponse("Hello, world. You're at the polls index.")
|
||||||
|
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
@@ -21,10 +21,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = "django-insecure-c$q7wdq+u@ow74wp!&zzkxdylkueu)(+34e%!e0du&bjwoqz9z"
|
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = bool(os.getenv("DEBUG"))
|
DEBUG = bool(os.getenv("DEBUG", False))
|
||||||
|
|
||||||
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
|
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ WSGI_APPLICATION = "website.wsgi.application"
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql",
|
"ENGINE": "django.db.backends.postgresql",
|
||||||
"DBNAME": os.getenv("POSTGRES_DBNAME"),
|
"NAME": os.getenv("POSTGRES_DBNAME"),
|
||||||
"USER": os.getenv("POSTGRES_USER"),
|
"USER": os.getenv("POSTGRES_USER"),
|
||||||
"PASSWORD": os.getenv("POSTGRES_PASSWORD"),
|
"PASSWORD": os.getenv("POSTGRES_PASSWORD"),
|
||||||
"HOST": os.getenv("POSTGRES_HOST"),
|
"HOST": os.getenv("POSTGRES_HOST"),
|
||||||
@@ -110,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
LANGUAGE_CODE = "en-us"
|
LANGUAGE_CODE = "en-us"
|
||||||
|
|
||||||
TIME_ZONE = "UTC"
|
TIME_ZONE = "Europe/Amsterdam"
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ Including another URLconf
|
|||||||
1. Import the include() function: from django.urls import include, path
|
1. Import the include() function: from django.urls import include, path
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, include
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path("polls/", include("polls.urls")),
|
||||||
|
path("admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user