Initial build

This commit is contained in:
2025-10-17 11:55:45 +02:00
parent 4b65f134fe
commit feb4663a3f
3 changed files with 60 additions and 13 deletions

View File

@@ -0,0 +1,28 @@
name: Urania unit tests
run-name: ${{ gitea.actor }} is testing Urania branch ${{ gitea.ref_name }}
on:
push:
branches:
- '*'
jobs:
Run-unit-tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.13.5
- name: Install requirements
run: |
pip install --upgrade pip
pip install -r src/requirements.txt
- name: Run unit tests
env:
DJANGO_SECRET_KEY: 'u92=rjf!))-h!1l9z%4i2xwk^t6%l+$z!$a%1_5zba4_9=ypj1'
working-directory: src
run:
python3 manage.py test

20
docker/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
FROM python:3.12
COPY src/requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /pda-new
# Copy control files and pull in dependencies
COPY src/ ./
ENV DJANGO_APP_PORT=8000
ENV DJANGO_SECRET_KEY='=m=3)ea$s@*u25(8_9197vyh$8d+8_qqd7@*n6t6#^zih(t1rj'
ENV DJANGO_ALLOWED_HOSTS='localhost','127.0.0.1'
EXPOSE ${DJANGO_APP_PORT}
ENTRYPOINT ["python","manage.py"]
CMD ["runserver",${DJANGO_APP_PORT}]

View File

@@ -1,28 +1,27 @@
""" """
Django settings for config project. Django settings for PDA-New
Generated by 'django-admin startproject' using Django 5.2.5. Generated by 'django-admin startproject' using Django 5.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.2/ref/settings/
""" """
import os import os
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv from environ import Env
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
ENV_FILE = os.path.join(BASE_DIR,'.env')
load_dotenv(BASE_DIR / ".env") env = Env()
env.read_env(ENV_FILE)
SECRET_KEY = env("DJANGO_SECRET_KEY", default='')
print('Starting without a secret key is not recommended in production') if not SECRET_KEY else None
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"] DEBUG = env.bool("DJANGO_DEBUG", default=False)
DEBUG = int(os.environ.get("DJANGO_DEBUG", default=0)) print('Debug mode ENABLED. Disable this before going into production') if DEBUG else None
ALLOWED_HOSTS = os.environ.get(
"DJANGO_ALLOWED_HOSTS", default="localhost 127.0.0.1 0.0.0.0" ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS",
).split() default="localhost,127.0.0.1,0.0.0.0")
INSTALLED_APPS = [ INSTALLED_APPS = [
"django.contrib.admin", "django.contrib.admin",