114 Commits
Author SHA1 Message Date
pi-ux-ce da4b86f4d3 no need this anymore
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
2026-03-17 10:31:21 +00:00
pi-ux-ce b5ef38bc0d try gemini ai idea
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m48s
2026-03-17 10:26:34 +00:00
pi-ux-ce c5b7e9dcde moving the env variables
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m55s
2026-03-17 10:13:24 +00:00
pi-ux-ce b611d41e8a moving the env variables
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 3m41s
2026-03-17 09:51:14 +00:00
pi-ux-ce c3ba43b0fa moving the env variables 2026-03-17 09:47:51 +00:00
pierre geeraert dc0e006e0f change link
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m32s
2026-03-16 23:26:42 +00:00
pierre geeraert 0b66858969 also try for the icon url
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m44s
2026-03-16 23:11:48 +00:00
pierre geeraert 16c8fba623 trying to variablise the title of the blank page
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-03-16 23:08:44 +00:00
pierre geeraert 852fccd95c remove extra slash
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m36s
2026-03-16 23:04:11 +00:00
pierre geeraert 316d07db61 default page is set and button to got to favorite ones
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m52s
2026-03-16 22:55:19 +00:00
pierre geeraert bf99f618f6 fetch only latest commit from main branch
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m43s
2026-03-16 22:09:19 +00:00
pierre geeraert 534f0cb7cb move the vars
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m37s
2026-03-16 21:59:35 +00:00
pierre geeraert 974f6820d4 move the vars 2026-03-16 21:53:47 +00:00
pierre geeraert 6ccf910e29 add env variable
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 3m5s
2026-03-16 21:47:03 +00:00
pi-ux-ce d05a3e2dc6 Merge pull request 'testing' (#8) from testing into main
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4m7s
Reviewed-on: #8
2026-03-16 21:06:42 +00:00
pierre geeraert 8be8b44584 also variablize DEBUG
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 21:03:28 +00:00
pierre geeraert 4a028c04c9 fix the extra s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:59:41 +00:00
pierre geeraert 1f1d7ab75d convert it to list
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:59:11 +00:00
pierre geeraert e0e5d9e290 trying to variablise allowed_hosts
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:33:46 +00:00
pierre geeraert 181eb67501 remove useless imports
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:21:28 +00:00
pierre geeraert 8af976c528 change path as well
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:16:01 +00:00
pierre geeraert beba1f16b4 changing path
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
2026-03-16 20:14:47 +00:00
pierre geeraert 76d0cbdb8d default url
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:03:53 +00:00
pierre geeraert 6ff0bb31d3 fix name of the module
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 20:03:20 +00:00
pierre geeraert e78825b99f importnt first argument
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 19:57:06 +00:00
pi-ux-ce 33a9d6fec7 d
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
2026-03-16 18:36:55 +00:00
pi-ux-ce b01145e6bd adding nano
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m40s
2026-03-16 18:33:22 +00:00
pi-ux-ce 06024c82c1 trying like that
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 18:30:37 +00:00
pi-ux-ce ce4a4838f1 adding required value
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
2026-03-16 18:26:03 +00:00
pi-ux-ce f80cfbeba7 adding required value
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 18:24:15 +00:00
pi-ux-ce 61e5966083 missed requirements
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-03-16 18:18:46 +00:00
pi-ux-ce f49a606693 trying this url conf
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 18:13:52 +00:00
pi-ux-ce 2b866b32bb enable redirect..tryton.geeraert.eu
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
2026-03-16 17:50:55 +00:00
pi-ux-ce 97896b5170 changing the authorised URL
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-03-16 14:50:49 +00:00
pi-ux-ce 3647ff15e1 trying to trigger a new image
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
2026-03-16 14:42:55 +00:00
pi-ux-ce 267f753452 using the testing branch
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-03-16 14:36:44 +00:00
pi-ux-ce c33e463e09 addign a restart after restarT
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-03-16 14:32:41 +00:00
pi-ux-ce 40cfc3c9f5 prevent main runner to run if there was a testing change 2026-03-16 14:21:39 +00:00
pi-ux-ce 632ba5257e fixing image name
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m39s
2026-03-16 10:42:57 +00:00
pi-ux-ce 7127effdaf trying to setup the django testing image 2026-03-16 10:39:26 +00:00
pi-ux-ce ca3f7e964e change title page
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m2s
2026-03-03 23:12:26 +00:00
pi-ux-ce 904e779b59 changing the extra >
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m23s
2026-03-03 22:55:55 +00:00
pi-ux-ce 63054b4a3a adding some print
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m56s
2026-02-05 20:11:01 +00:00
pi-ux-ce 871f3c5ba8 put lower var
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 7m54s
2026-02-03 14:51:21 +00:00
pi-ux-ce 9c706bb9b1 Update .gitea/workflows/dockerfile_runner.yaml
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m14s
2026-01-20 00:02:19 +00:00
pi-ux-ce 06c57ca837 try v6
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2s
2026-01-19 23:55:53 +00:00
pi-ux-ce 39a3ec055b try again
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 23:54:36 +00:00
pi-ux-ce 401cf8e1a7 Update .gitea/workflows/dockerfile_runner.yaml
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 10s
2026-01-19 23:46:19 +00:00
pi-ux-ce f50d624d22 set git location
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 10s
2026-01-19 23:45:27 +00:00
pi-ux-ce 4aeee1acb5 manually git pull
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 7s
2026-01-19 23:43:31 +00:00
pi-ux-ce b6a9cfed19 do not clean before checkout
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 23:36:15 +00:00
pi-ux-ce a67dcf763b trigger new build
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 23:31:52 +00:00
pi-ux-ce 0f58c2dcae only if present
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m12s
2026-01-19 20:53:13 +00:00
pi-ux-ce 9cb1418b0d avoid crashing if no source file
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 10s
2026-01-19 20:48:49 +00:00
pi-ux-ce f62e6ca651 trying to cache git folder
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 8s
2026-01-19 20:47:06 +00:00
pi-ux-ce 0c6ddd4904 trying host_runner
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m38s
2026-01-19 19:46:48 +00:00
Pierre Geeraert 14d4dbfe97 update runner to add curl
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 17:53:28 +00:00
Pierre Geeraert 50d0c2cd4d debug
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5m57s
2026-01-19 17:43:25 +00:00
Pierre Geeraert 4fe45169c3 try with the exact version of the runner
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m36s
2026-01-19 17:40:43 +00:00
Pierre Geeraert 78d93a16eb remove kubeconfig
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 23s
2026-01-19 17:25:50 +00:00
Pierre Geeraert b94bf528be display kubeconfig
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 17:23:49 +00:00
Pierre Geeraert 11ad57bce4 no need to download docker.io as the base image is doing it now 2026-01-19 17:16:07 +00:00
Pierre Geeraert 495a55f8c1 try to install docker
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 7m17s
2026-01-19 16:54:55 +00:00
Pierre Geeraert c611360c04 try debug
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 29s
2026-01-19 16:52:17 +00:00
Pierre Geeraert ada418374b trying gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:latest
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 35s
2026-01-19 15:57:09 +00:00
Pierre Geeraert 3bf7f2a195 trying to use debian
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5m41s
2026-01-19 13:46:25 +00:00
pi-ux-ce 2d22cab6e7 changing to debian image
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-19 11:54:38 +00:00
pi-ux-ce 96dcbe1798 Update django_code/django_code/urls.py
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m14s
2026-01-08 23:58:04 +00:00
pi-ux-ce ac6dc5b426 revert e2d3868a9e
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m58s
revert add prowlarr script in tash until I create a prowlarr project with celery
2026-01-08 23:53:12 +00:00
pi-ux-ce b4f22ffeea update due to some errors
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2m14s
2026-01-08 23:42:30 +00:00
pi-ux-ce ca3ed630ed adding the URL
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m42s
2026-01-08 23:34:27 +00:00
pi-ux-ce e2d3868a9e add prowlarr script in tash until I create a prowlarr project with celery
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-01-08 23:31:22 +00:00
Pierre Geeraert 47314620be can only concatenate str (not bytes) to str
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m35s
2026-01-07 17:57:22 +00:00
Pierre Geeraert f26f3f2665 try a new function with clearing the key
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m45s
2026-01-07 13:42:47 +00:00
Pierre Geeraert 938b37e920 add some comments
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m52s
2026-01-07 13:31:57 +00:00
Pierre Geeraert 2c5a989306 fix syntax error
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m1s
2026-01-07 13:19:24 +00:00
Pierre Geeraert 88a6dd9316 adding the default page in case there is no redis entry
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2m12s
2026-01-07 12:08:03 +00:00
Pierre Geeraert 77742c1d6f ubuntu-slim wasn't working
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m33s
2025-12-09 10:20:21 +00:00
Pierre Geeraert ba16c6475a Merge branch 'main' of https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-12-09 09:50:42 +00:00
Pierre Geeraert 1735098b3a trying ubuntu-slim 2025-12-09 09:49:49 +00:00
pierre geeraert 2fdaaa47ab f you are just trying to redirect to an absolute URL stored in Redis, your code should work provided the string is clean.
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m58s
A robust way to ensure it's treated as a simple URL might involve using Django's HttpResponseRedirect directly instead of the redirect shortcut:
2025-12-08 23:44:06 +00:00
pierre geeraert bd4e4aed27 try to debug it
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m1s
2025-12-08 23:34:41 +00:00
pierre geeraert 94a8240ad4 In Django, the <str:key> part of your URL pattern is designed to capture a value from the URL (e.g., if someone visits /redirect/go/xyz123) and pass it to the view function as a keyword argument named key.
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m51s
2025-12-08 23:22:27 +00:00
pierre geeraert be03af61ea prepare new function
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m44s
2025-12-08 23:14:34 +00:00
pierre geeraert 4da34c98f3 forgot dependencies
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m15s
2025-12-08 23:05:49 +00:00
pierre geeraert 12253f0621 try to work on the redirection
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m8s
2025-12-08 23:00:46 +00:00
Pierre Geeraert 369954f5d2 changing form submit path
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m3s
2025-12-08 09:16:20 +00:00
pierre geeraert 4eee702dce add the comment for later review
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m0s
2025-12-07 23:46:59 +00:00
pierre geeraert e90daa2e61 forgot the url
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m19s
2025-12-07 23:39:45 +00:00
pierre geeraert cc8570d02f adding reddit downloader
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m48s
2025-12-07 23:22:46 +00:00
Pierre Geeraert 98e5ea965c forgot one variable
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m59s
2025-12-05 11:16:44 +00:00
Pierre Geeraert 7a98ab1c6d cache seems good , doing a test
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 2m49s
2025-12-05 11:12:30 +00:00
Pierre Geeraert 70973a63fb frogot the step to move the cache
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2m36s
2025-12-05 10:30:33 +00:00
Pierre Geeraert ad82f73c1d promising solution using volume mount
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-05 10:24:44 +00:00
Pierre Geeraert e08016c103 promising solution using volume mount
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-05 10:08:57 +00:00
Pierre Geeraert a65e99b199 another test
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-05 10:04:07 +00:00
Pierre Geeraert 4853150f07 another test
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-12-05 10:02:22 +00:00
Pierre Geeraert a341e66c13 another test
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-05 09:53:55 +00:00
pierre geeraert 874779d230 now reverting
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m15s
2025-12-04 23:52:19 +00:00
pierre geeraert 779e8a8b0f to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:46:47 +00:00
pierre geeraert 8f35e88ce4 to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:42:58 +00:00
pierre geeraert 71e874cfb4 to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:40:27 +00:00
pierre geeraert 622b8942b5 to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:40:16 +00:00
pierre geeraert 7aeb7d094c to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 27s
2025-12-04 23:39:10 +00:00
pierre geeraert 4ee80f8b7e to revert, just a try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:37:57 +00:00
pierre geeraert 4859fa6877 No matching distribution found for json
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m2s
2025-12-04 23:17:56 +00:00
pierre geeraert a1d831cdf2 another cache try
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 23:17:08 +00:00
pierre geeraert a3ee639d77 put the steps for a reddit downloader
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5m1s
2025-12-04 22:59:15 +00:00
pierre geeraert cd274aea81 change path
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m49s
2025-12-04 19:59:53 +00:00
Pierre Geeraert aaa548eb21 1.651 IndentationError: unindent does not match any outer indentation level
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m22s
2025-12-04 18:08:51 +00:00
Pierre Geeraert 99f05a055d add the retry function
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 5m46s
2025-12-04 17:00:48 +00:00
Pierre Geeraert e614d50f9c also clean .gitea/python_build
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m55s
2025-12-04 16:54:01 +00:00
Pierre Geeraert 20526c829c revert everything
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 16:53:18 +00:00
pi-ux-ce c9ed33f108 Merge pull request 'addign this for the syntax but this solution is too slow' (#6) from revert-caching into main
Gitea Actions Demo / changes (push) Successful in 24s
Gitea Actions Demo / Build-dockerfile (push) Has been cancelled
Gitea Actions Demo / Explore-Gitea-Actions (push) Has started running
Reviewed-on: #6
2025-12-04 16:50:07 +00:00
26 changed files with 992 additions and 205 deletions
-16
View File
@@ -1,16 +0,0 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
-15
View File
@@ -1,15 +0,0 @@
django
psycopg2
requests
proxmoxer
docker
kubernetes
ruamel.yaml
pyyaml
django-bootstrap-v5
jinja2
watchdog
celery
redis
lxml
requests
+46 -87
View File
@@ -2,96 +2,43 @@ name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: on:
push: push:
#paths-ignore: branches:
# - 'requirements.txt' - main
paths-ignore:
- 'django_testing/dockerfile'
issue_comment: issue_comment:
types: [created] types: [created]
jobs: jobs:
# Job to check for file changes and set an output
changes:
runs-on: ubuntu-latest
outputs:
requirements_changed: ${{ steps.filter.outputs.requirements }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
requirements:
- 'requirements.txt'
Build-dockerfile:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.requirements_changed == 'true' }}
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Compute next version
id: versioning
run: |
latest="${{ vars.PYTHON_VERSION }}"
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "next_version=$next_version" >> $GITHUB_ENV
echo "Variables used :"
echo "------------------------------------------------"
echo "Next version: $next_version"
- uses: actions/cache@v3
with:
path: /root/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-source: /root/.cache/pip
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to gitea
uses: docker/login-action@v3
with:
registry: gitea.tryton.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:.gitea/python_build"
push: true
tags: |
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:${{ env.next_version }}
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache,mode=max
- name: update version in the variable
run: |
curl -X PUT -H "Content-Type: application/json" \
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/PYTHON_VERSION \
-d "{\"Value\":\"$next_version\"}"
Explore-Gitea-Actions: Explore-Gitea-Actions:
runs-on: ubuntu-latest env:
RUNNER_TOOL_CACHE: /toolcache
container:
image: gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6
volumes:
- act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default
runs-on: host-runner
steps: steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: restore git folder if exist
run: if [ -d "/opt/hostedtoolcache/${{ github.event.repository.name }}/" ]; then cp -r /opt/hostedtoolcache/${{ github.event.repository.name }}/ ${{ gitea.workspace }}; fi
- name: Check Docker Version
run: whereis docker
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v4
clean: false
fetch-depth: 1
ref: 'main'
# - name: Manually check out repository code
# run: cd ${{ gitea.workspace }} ; git pull origin main
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository - name: List files in the repository
run: | run: |
ls ${{ gitea.workspace }} ls ${{ gitea.workspace }}
@@ -106,18 +53,19 @@ jobs:
echo "------------------------------------------------" echo "------------------------------------------------"
echo "Next version: $next_version" echo "Next version: $next_version"
- uses: actions/cache@v3 - name: Cache Docker layers
uses: actions/cache@v4
with: with:
path: /root/.cache/pip path: /opt/hostedtoolcache/.buildx-cache
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-pip- ${{ runner.os }}-buildx-
- name: inject cache into docker - name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0 uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with: with:
cache-source: /root/.cache/pip cache-source: /opt/hostedtoolcache/pip
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -133,11 +81,19 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
push: true push: true
build-args: |
ALLOWED_HOSTS='django.tryton.geeraert.eu'
DEBUG='True'
tags: | tags: |
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }}
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache cache-from: type=local,src=/opt/hostedtoolcache/.buildx-cache
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache,mode=max cache-to: type=local,dest=/opt/hostedtoolcache/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /opt/hostedtoolcache/.buildx-cache
mv /opt/hostedtoolcache/.buildx-cache-new /opt/hostedtoolcache/.buildx-cache
- name: Rollout Django to force pulling the new image - name: Rollout Django to force pulling the new image
uses: actions-hub/kubectl@master uses: actions-hub/kubectl@master
@@ -160,3 +116,6 @@ jobs:
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \ --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION \ https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION \
-d "{\"Value\":\"$next_version\"}" -d "{\"Value\":\"$next_version\"}"
- name: backup git for future use
run: cp -r ${{ gitea.workspace }} /opt/hostedtoolcache/${{ github.event.repository.name }}/
@@ -0,0 +1,69 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- "testing"
paths:
- 'django_testing/dockerfile'
tags-ignore:
- '*'
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute next version
id: versioning
run: |
latest="${{ vars.VERSION_TESTING }}"
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "next_version=$next_version" >> $GITHUB_ENV
echo "Variables used :"
echo "------------------------------------------------"
echo "Next version: $next_version"
- name: Login to gitea
uses: docker/login-action@v3
with:
registry: gitea.tryton.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: django_testing/
push: true
tags: |
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:latest
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }}
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache,mode=max
- name: update version in the variable
run: |
curl -X PUT -H "Content-Type: application/json" \
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION_TESTING \
-d "{\"Value\":\"$next_version\"}"
- name: Rollout Django to force pulling the new image
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: rollout restart deployment django-testing -n django-testing
- run: echo "🍏 This job's status is ${{ job.status }}."
@@ -0,0 +1,23 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- "testing"
tags-ignore:
- '*'
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Rollout Django to force pulling the new image
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: rollout restart deployment django-testing -n django-testing
- run: echo "🍏 This job's status is ${{ job.status }}."
-67
View File
@@ -1,67 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: django-python
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: django-webserver
namespace: django-python
spec:
replicas: 1
selector:
matchLabels:
app: django-python
template:
metadata:
labels:
app: django-python
spec:
containers:
- name: django-python
image: gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
name: webserver-port
volumeMounts:
## - name: django-python-code
# mountPath: /code
- name: servarr-data
mountPath: /data
readOnly: true
- name: secret-kubeconfig
mountPath: /kubeconfig
resources:
limits:
cpu: 100m
memory: 200Mi
volumes:
- name: django-python-code
persistentVolumeClaim:
claimName: django-python-code
- name: servarr-data
hostPath:
path: /data
- name: secret-kubeconfig
secret:
defaultMode: 420
secretName: kubeconfig
---
apiVersion: v1
kind: Service
metadata:
name: webserver
namespace: django-python
spec:
ports:
- name: http
port: 8000
protocol: TCP
selector:
app: django-python
+7
View File
@@ -0,0 +1,7 @@
from django.conf import settings
from django_hosts import patterns, host
host_patterns = patterns('',
host(r"django-testing", settings.ROOT_URLCONF, name="django-testing"),
host(r"redirect", 'website_redirection.urls', name="redirect"),
)
+11 -4
View File
@@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/ https://docs.djangoproject.com/en/4.2/ref/settings/
""" """
import os
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -23,10 +23,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-71%)_#e#o9-dl2o^6mfud-*rw+4+8vy-nd*bzeier&(34ap-p9' SECRET_KEY = 'django-insecure-71%)_#e#o9-dl2o^6mfud-*rw+4+8vy-nd*bzeier&(34ap-p9'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True #DEBUG = os.getenv("DEBUG")
DEBUG = os.getenv("DEBUG", "False").lower() in ("true", "1", "t")
ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu','localhost']
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
# Application definition # Application definition
@@ -38,9 +39,11 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'bootstrap5', 'bootstrap5',
'django_hosts',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
'django_hosts.middleware.HostsRequestMiddleware',
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@@ -48,15 +51,19 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_hosts.middleware.HostsResponseMiddleware',
] ]
ROOT_URLCONF = 'django_code.urls' ROOT_URLCONF = 'django_code.urls'
ROOT_HOSTCONF = 'django_code.hosts'
DEFAULT_HOST = 'django-testing'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
#'DIRS': ["/code/django_code/templates","/code/django_code/dashboard/templates/"], #'DIRS': ["/code/django_code/templates","/code/django_code/dashboard/templates/"],
'DIRS': [BASE_DIR / "templates","django_code/dashboard/templates/","django_code/stash_management/templates"], 'DIRS': [BASE_DIR / "templates","django_code/dashboard/templates/","django_code/stash_management/templates","django_code/website_redirection/templates"],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
+15 -3
View File
@@ -25,6 +25,8 @@ from dashboard import views as dashboardview
from kubernetes_connection import apps as kubernetes_connection from kubernetes_connection import apps as kubernetes_connection
from stash_management import apps as stashapp from stash_management import apps as stashapp
from stash_management import views as stashview from stash_management import views as stashview
from website_redirection import apps as website_redirectionapp
urlpatterns = [ urlpatterns = [
# path('admin/', admin.site.urls), # path('admin/', admin.site.urls),
@@ -34,7 +36,16 @@ urlpatterns = [
path('simpsons/', random_simpsons.simpsons), path('simpsons/', random_simpsons.simpsons),
path('download_file/', random_simpsons.download_file), path('download_file/', random_simpsons.download_file),
################### paperless ################### ################### Redirect ###################
path('redirect/hello/', website_redirectionapp.hello),
path('redirect/set/', website_redirectionapp.redirect),
path('redirect/get/<str:key>', website_redirectionapp.display_key),
path('redirect/go/<str:key>', website_redirectionapp.redirect_to_key),
path('redirect/redirect-form/', website_redirectionapp.redirect_process, name='submit_form'),
path('redirect/clearkey/', website_redirectionapp.clearkey_process, name='submit_form'),
################### paperless ###################
path('paperless/hello/', paperless_django.hello), path('paperless/hello/', paperless_django.hello),
# path('simpsons/', random_simpsons.simpsons), # path('simpsons/', random_simpsons.simpsons),
@@ -59,17 +70,18 @@ urlpatterns = [
path('kubernetes_connection/scale_up/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_up), path('kubernetes_connection/scale_up/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_up),
path('kubernetes_connection/scale_down/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_down), path('kubernetes_connection/scale_down/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_down),
################## kubernetes_connection##### ################## stash#####
path('stash/', stashview.home), path('stash/', stashview.home),
path('stash/hello/', stashapp.hello), path('stash/hello/', stashapp.hello),
path('stash/form/', stashapp.form), path('stash/form/', stashapp.form),
path('stash/incremental/', stashapp.incremental), path('stash/incremental/', stashapp.incremental),
path('stash/album/', stashapp.album), path('stash/album/', stashapp.album),
path('stash/album-form/', stashapp.album_form, name='submit_form'), path('stash/album-form/', stashapp.album_form, name='submit_form'),
path('stash/simple/', stashapp.simple),
path('stash/simple-form/', stashapp.simple_form, name='submit_form'),
path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'), path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'),
path('stash/incremental-form/', stashapp.incremental_form, name='submit_form'), path('stash/incremental-form/', stashapp.incremental_form, name='submit_form'),
# path('bookstack/', docker_connection.apps.hello), # path('bookstack/', docker_connection.apps.hello),
# path('test/', docker_connection.apps.http_call_test), # path('test/', docker_connection.apps.http_call_test),
# path('proxmox/', docker_connection.apps.proxmox), # path('proxmox/', docker_connection.apps.proxmox),
+63 -4
View File
@@ -2,7 +2,6 @@ from django.apps import AppConfig
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.shortcuts import redirect from django.shortcuts import redirect
#from jinja2 import Environment, FileSystemLoader
from django.core.files import File from django.core.files import File
from kubernetes import client, config from kubernetes import client, config
from celery import shared_task from celery import shared_task
@@ -10,6 +9,7 @@ from celery import shared_task
from lxml import html from lxml import html
import requests import requests
import os import os
import json
import time import time
import random import random
import mimetypes import mimetypes
@@ -33,7 +33,7 @@ proxies = {
"https" : proxy_url "https" : proxy_url
} }
destination_folder = "/tmp/stash/" destination_folder = "/stash/"
def hello(request): def hello(request):
return HttpResponse('<h1>Hello stash!</h1>') return HttpResponse('<h1>Hello stash!</h1>')
@@ -41,7 +41,8 @@ def form(request):
return render(request, 'stash_form.html',{}) return render(request, 'stash_form.html',{})
def album(request): def album(request):
return render(request, 'album_form.html',{}) return render(request, 'album_form.html',{})
def simple(request):
return render(request, 'simple_form.html',{})
def check_and_create_destination_folder(name): def check_and_create_destination_folder(name):
#check if the output directory exist and create if not #check if the output directory exist and create if not
if not os.path.isdir(destination_folder): if not os.path.isdir(destination_folder):
@@ -116,10 +117,67 @@ def images_downloader(name,images_url_list,destination_named_folder):
opener = urlrequest.build_opener(proxy) opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener) urlrequest.install_opener(opener)
try:
urlrequest.urlretrieve(image_url, filename ) urlrequest.urlretrieve(image_url, filename )
except:
print("Can't download "+filename+" -- "+image_url)
individual_image_downloader.delay(image_url=image_url, filename=filename)
return 0 return 0
@shared_task()
def individual_image_downloader(image_url, filename ):
print("Downloading again: "+filename+" -- "+image_url)
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
try:
urlrequest.urlretrieve(image_url, filename )
except:
print("Still Can't download "+filename+" -- "+image_url+" == Cancelling")
return 0
def simple_form(request):
name = request.GET.get('name')
reddit_downloader(username=name)
text_generated = "successfully sent to the reddit downloader"
return HttpResponse(text_generated, content_type="text/plain")
def reddit_downloader(username):
#create the prerequisites folder
destination_named_folder = check_and_create_destination_folder(name=username)
url = "https://www.reddit.com/user/"+username+"/submitted/.json?limit=1000"
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
req = urlrequest.Request(url)
urlcurl = urlrequest.urlopen(req).read()
data = json.loads(urlcurl)
picture_list=[]
for children in data['data']['children']:
print("adding to the list : "+children['data']['url'])
picture_list.append(children['data']['url'])
images_downloader.delay(name=username,images_url_list=picture_list,destination_named_folder=destination_named_folder)
return 0
def redgif_donloader(username):
#on te front page of the user , https://www.redgifs.com/users/princesspizookie
# F12 and search network , find something that start as api.redgifs.com
# and the file is search?order=new&count=40&type=g
# copy as curl and you got the bearer
#curl curl 'https://api.redgifs.com/v2/users/princesspizookie/search?order=new&count=40&type=g'
#and you get the URLS , needs to be parsedw
return 0
def incremental(request): def incremental(request):
return render(request, 'incremental_form.html',{}) return render(request, 'incremental_form.html',{})
@@ -165,9 +223,10 @@ def increment_and_download(minimum_increment,maximum_increment,url,url_suffix,na
increment_generated ='000' + str(increment) increment_generated ='000' + str(increment)
url_generated = url+increment_generated+url_suffix url_generated = url+increment_generated+url_suffix
print(url_generated)
destination_filename = increment_generated+url_suffix destination_filename = increment_generated+url_suffix
destination_file = os.path.join(destination_named_folder,destination_filename) destination_file = os.path.join(destination_named_folder,destination_filename)
print(destination_file)
opener = urlrequest.build_opener(proxy) opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener) urlrequest.install_opener(opener)
urlrequest.urlretrieve(url_generated, destination_file ) urlrequest.urlretrieve(url_generated, destination_file )
@@ -10975,7 +10975,7 @@
</div> </div>
<!-- Product actions--> <!-- Product actions-->
<div class="card-footer p-4 pt-0 border-top-0 bg-transparent"> <div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
<div class="text-center"><a class="btn btn-outline-dark mt-auto" href="#">Add to cart</a></div> <div class="text-center"><a class="btn btn-outline-dark mt-auto" href="/stash/simple">Visit</a></div>
</div> </div>
</div> </div>
</div> </div>
@@ -0,0 +1,275 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Simple form</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
@charset "UTF-8";
.m-b-xs {
margin-bottom: 2%;
}
.m-b-md {
margin-bottom: 10%;
}
.m-t-xs {
margin-top: 2%;
}
.m-t-sm {
margin-top: 5%;
}
* {
outline: 0 !important;
}
body {
padding: 2% 0;
background-color: #37404a;
}
h1 {
font-family: "Roboto", sans-serif;
font-size: 2.2em;
font-weight: 300;
color: #85ffc7;
text-transform: uppercase;
}
p {
font-family: "Roboto", sans-serif;
font-size: 1.1em;
font-weight: 300;
color: #fff;
}
a {
color: #fff;
}
a:hover {
text-decoration: none;
color: #fff;
}
#survey-form label,
#survey-form .labels {
display: block;
margin-bottom: 2%;
font-family: "Roboto", sans-serif;
font-size: 1.1em;
font-weight: 300;
color: #fff;
letter-spacing: 0.5px;
}
#survey-form input::-webkit-input-placeholder {
color: transparent !important;
}
#survey-form input::-moz-placeholder {
color: transparent !important;
}
#survey-form input:-ms-input-placeholder {
color: transparent !important;
}
#survey-form input:-moz-placeholder {
color: transparent !important;
}
#survey-form input,
#survey-form select {
display: block;
width: 100%;
overflow: hidden;
outline: none;
border: 2px solid #333;
}
#survey-form input {
margin-top: 1.5%;
padding: 0 0 5px 0;
background: transparent;
border: none;
outline: none;
border-bottom: 2px solid #fff;
font-size: 1.1em;
font-weight: 300;
color: #85ffc7;
}
#survey-form input:focus {
border-color: #85ffc7;
}
#survey-form [type=checkbox],
#survey-form [type=radio] {
display: inline-block;
width: auto;
margin: 0px 10px 0 0;
}
#survey-form [type=checkbox],
#survey-form [type=radio] {
display: inline-block;
margin: 0 10px 0 0 !important;
position: relative;
top: 5px;
right: 0;
bottom: 0;
left: 0;
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
appearance: none;
height: 23px;
width: 23px;
transition: all 0.15s ease-out 0s;
background: #37404a;
color: #fff;
cursor: pointer;
outline: none;
z-index: 1000;
border: 1px solid #fff;
}
#survey-form [type=checkbox]:hover,
#survey-form [type=radio]:hover {
border-color: #85ffc7;
}
#survey-form [type=checkbox]:checked:before,
#survey-form [type=radio]:checked:before {
display: inline-block;
height: 21px;
width: 21px;
position: relative;
left: 0;
bottom: 0;
content: "";
text-align: center;
font-family: "Glyphicons Halflings";
line-height: 20px;
font-size: 15px;
color: #85ffc7;
}
#survey-form [type=checkbox]:focus,
#survey-form [type=radio]:focus {
outline: none;
border-color: #fff;
}
#survey-form [type=radio] {
border-radius: 50%;
}
#survey-form [type=radio]:after {
border-radius: 50%;
}
#survey-form [type=number] {
width: 45px;
}
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
}
#survey-form select {
height: 40px;
padding-left: 5px;
background-color: #37404a;
border: 2px solid #fff;
color: #85ffc7;
}
#survey-form select option {
padding: 5px 10px;
font-weight: 300;
cursor: pointer;
}
#survey-form select option:hover {
background-color: #85ffc7;
}
#survey-form textarea {
resize: none;
margin-top: 2%;
padding: 10px 10px 0px 20px;
width: 100%;
height: 90px;
color: #85ffc7;
background-color: #37404a;
border: 2px solid #fff;
}
#survey-form .btn {
display: inline-block;
position: relative;
width: 100%;
margin: 3% 0 0 0;
height: 45px;
text-transform: uppercase;
text-decoration: none;
cursor: pointer;
border: 3px solid #85ffc7;
border-radius: 0;
font-weight: 500;
font-size: 1.2em;
color: #85ffc7;
text-align: center;
background: none;
transition: color 0.25s ease;
}
#survey-form .btn:after {
position: absolute;
content: "";
top: 0;
left: 0;
width: 0;
height: 100%;
background-color: #85ffc7;
transform-origin: left;
transition: width 0.5s ease;
z-index: -1;
}
#survey-form .btn:hover {
color: #37404a;
}
#survey-form .btn:hover:after {
width: 100%;
}
#survey-form fieldset {
margin: 5% 0 0 0;
}
.copyright {
text-align: center;
font-size: 10px;
color: #fff;
}
.copyright i {
color: #ef5350;
}
@media only screen and (max-width: 600px) {
body {
padding: 8% 0;
}
}
</style>
</head>
<main id="main" class="container">
<div class="row">
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
<div class="m-b-md text-center">
<h1 id="title">Stash Form</h1>
<p id="description" class="description" class="text-center">Download form</p>
</div>
<form method="GET" action="/stash/simple-form/" id="survey-form" name="survey-form">
<fieldset>
<label for="name" id="name-label">
Name *
<input class="" type="text" id="name" name="name" placeholder="Enter your name (required)" required />
</label>
</fieldset>
<button id="submit" type="submit" class="btn">Submit the form</button>
</form>
</div>
</div>
</main>
</html>
+3
View File
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
+53
View File
@@ -0,0 +1,53 @@
import redis
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render
r = redis.Redis(
host='django-redis-svc',
port=6379,
db=0 # The default Redis database index
)
def hello(request):
return HttpResponse('<h1>Hello redirect!</h1>')
def redirect(request):
return render(request, 'redirect_form.html',{})
def clearkey_process(request):
key = request.GET.get('key')
r.delete(key)
return 0
def redirect_process(request):
key = request.GET.get('key')
value = request.GET.get('value')
key = key.lower()
r.set(key, value)
text_generated = "successfully set "+value+" to "+key
return HttpResponse(text_generated, content_type="text/plain")
def display_key(request,key):
value = r.get(key)
value_extracted = str(value.decode())
text_generated = key+" is set to "+value_extracted
return HttpResponse(text_generated, content_type="text/plain")
def redirect_to_key(request,key):
value = r.get(key)
if value == None:
icon_url = r.get('icon')
if icon_url == None:
icon_url = "https://cdn-icons-png.flaticon.com/512/6402/6402576.png"
print(key+" is not setup, displaying default page")
return render(request, 'blank_page.html', {'title': key,'icon_url':icon_url})
else:
value_extracted = str(value.decode('utf-8'))
print(key+" is setup to : "+value_extracted)
print(value_extracted)
return HttpResponseRedirect(value_extracted)
@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/x-icon" href="https://cdn-icons-png.flaticon.com/512/6402/6402576.png">
<title>{{ title }}</title>
</head>
</html>
@@ -0,0 +1,294 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Redirect form</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
@charset "UTF-8";
.m-b-xs {
margin-bottom: 2%;
}
.m-b-md {
margin-bottom: 10%;
}
.m-t-xs {
margin-top: 2%;
}
.m-t-sm {
margin-top: 5%;
}
* {
outline: 0 !important;
}
body {
padding: 2% 0;
background-color: #37404a;
}
h1 {
font-family: "Roboto", sans-serif;
font-size: 2.2em;
font-weight: 300;
color: #85ffc7;
text-transform: uppercase;
}
p {
font-family: "Roboto", sans-serif;
font-size: 1.1em;
font-weight: 300;
color: #fff;
}
a {
color: #fff;
}
a:hover {
text-decoration: none;
color: #fff;
}
#survey-form label,
#survey-form .labels {
display: block;
margin-bottom: 2%;
font-family: "Roboto", sans-serif;
font-size: 1.1em;
font-weight: 300;
color: #fff;
letter-spacing: 0.5px;
}
#survey-form input::-webkit-input-placeholder {
color: transparent !important;
}
#survey-form input::-moz-placeholder {
color: transparent !important;
}
#survey-form input:-ms-input-placeholder {
color: transparent !important;
}
#survey-form input:-moz-placeholder {
color: transparent !important;
}
#survey-form input,
#survey-form select {
display: block;
width: 100%;
overflow: hidden;
outline: none;
border: 2px solid #333;
}
#survey-form input {
margin-top: 1.5%;
padding: 0 0 5px 0;
background: transparent;
border: none;
outline: none;
border-bottom: 2px solid #fff;
font-size: 1.1em;
font-weight: 300;
color: #85ffc7;
}
#survey-form input:focus {
border-color: #85ffc7;
}
#survey-form [type=checkbox],
#survey-form [type=radio] {
display: inline-block;
width: auto;
margin: 0px 10px 0 0;
}
#survey-form [type=checkbox],
#survey-form [type=radio] {
display: inline-block;
margin: 0 10px 0 0 !important;
position: relative;
top: 5px;
right: 0;
bottom: 0;
left: 0;
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
appearance: none;
height: 23px;
width: 23px;
transition: all 0.15s ease-out 0s;
background: #37404a;
color: #fff;
cursor: pointer;
outline: none;
z-index: 1000;
border: 1px solid #fff;
}
#survey-form [type=checkbox]:hover,
#survey-form [type=radio]:hover {
border-color: #85ffc7;
}
#survey-form [type=checkbox]:checked:before,
#survey-form [type=radio]:checked:before {
display: inline-block;
height: 21px;
width: 21px;
position: relative;
left: 0;
bottom: 0;
content: "";
text-align: center;
font-family: "Glyphicons Halflings";
line-height: 20px;
font-size: 15px;
color: #85ffc7;
}
#survey-form [type=checkbox]:focus,
#survey-form [type=radio]:focus {
outline: none;
border-color: #fff;
}
#survey-form [type=radio] {
border-radius: 50%;
}
#survey-form [type=radio]:after {
border-radius: 50%;
}
#survey-form [type=number] {
width: 45px;
}
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
}
#survey-form select {
height: 40px;
padding-left: 5px;
background-color: #37404a;
border: 2px solid #fff;
color: #85ffc7;
}
#survey-form select option {
padding: 5px 10px;
font-weight: 300;
cursor: pointer;
}
#survey-form select option:hover {
background-color: #85ffc7;
}
#survey-form textarea {
resize: none;
margin-top: 2%;
padding: 10px 10px 0px 20px;
width: 100%;
height: 90px;
color: #85ffc7;
background-color: #37404a;
border: 2px solid #fff;
}
#survey-form .btn {
display: inline-block;
position: relative;
width: 100%;
margin: 3% 0 0 0;
height: 45px;
text-transform: uppercase;
text-decoration: none;
cursor: pointer;
border: 3px solid #85ffc7;
border-radius: 0;
font-weight: 500;
font-size: 1.2em;
color: #85ffc7;
text-align: center;
background: none;
transition: color 0.25s ease;
}
#survey-form .btn:after {
position: absolute;
content: "";
top: 0;
left: 0;
width: 0;
height: 100%;
background-color: #85ffc7;
transform-origin: left;
transition: width 0.5s ease;
z-index: -1;
}
#survey-form .btn:hover {
color: #37404a;
}
#survey-form .btn:hover:after {
width: 100%;
}
#survey-form fieldset {
margin: 5% 0 0 0;
}
.copyright {
text-align: center;
font-size: 10px;
color: #fff;
}
.copyright i {
color: #ef5350;
}
@media only screen and (max-width: 600px) {
body {
padding: 8% 0;
}
}
</style>
</head>
<main id="main" class="container">
<div class="row">
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
<div class="m-b-md text-center">
<h1 id="title">Redirect Form</h1>
<p id="description" class="description" class="text-center">Download form</p>
</div>
<form method="GET" action="/redirect-form/" id="survey-form" name="survey-form">
<fieldset>
<label for="key" id="key-label">
Key *
<input class="" type="text" id="key" name="key" placeholder="Enter your key (required)" required />
</label>
</fieldset>
<fieldset>
<label for="value" id="value-label">
Value *
<input class="" type="value" id="value" name="value" placeholder="Enter the value (required)" />
</label>
</fieldset>
<button id="submit" type="submit" class="btn">Submit the form</button>
<button id="clearkey" type="submit" formaction="/clearkey/" class="btn">Clear the key</button>
<div class="container">
<div class="row">
<div class="col">
<button type="button" onclick="location.href='/go/streaming'" class="btn">Streaming</button>
</div>
<div class="col">
<button type="button" onclick="location.href='/go/streaming-sam'" class="btn">Streaming Sam</button>
</div>
</div>
</div>
</form>
</div>
</div>
</main>
</html>
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+35
View File
@@ -0,0 +1,35 @@
"""
URL configuration for django_code project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from website_redirection import apps as website_redirectionapp
urlpatterns = [
# path('admin/', admin.site.urls),
################### Redirect ###################
path('', website_redirectionapp.redirect),
path('hello/', website_redirectionapp.hello),
path('set/', website_redirectionapp.redirect),
path('get/<str:key>', website_redirectionapp.display_key),
path('go/<str:key>', website_redirectionapp.redirect_to_key),
path('redirect-form/', website_redirectionapp.redirect_process, name='submit_form'),
path('clearkey/', website_redirectionapp.clearkey_process, name='submit_form'),
]
+8
View File
@@ -0,0 +1,8 @@
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from django.shortcuts import render
def hello(request):
return HttpResponse('<h1>Hello Django!</h1>')
+32
View File
@@ -0,0 +1,32 @@
# Stage 1: Build the module
FROM python:3
MAINTAINER pi-ux-ce
ENV PYTHONUNBUFFERED 1
WORKDIR /code/
# Install build tools and MaxMind library
RUN apt-get update && \
apt-get install -y git nano && \
rm -rf /var/lib/apt/lists/*
# Clone the specific GeoIP2 module project
RUN git clone -b testing https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r Django_kube/requirements.txt
RUN python Django_kube/django_code/manage.py migrate
COPY entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["/code/entrypoint.sh"]
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
cd Django_kube
#another methid but needs to rm -rf before
#git clone --depth 1 -b main https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
git pull
pip install -r requirements.txt
python django_code/manage.py migrate
python django_code/manage.py runserver "0.0.0.0:8000"
+1
View File
@@ -9,3 +9,4 @@ services:
command: python manage.py runserver 0.0.0.0:7000 command: python manage.py runserver 0.0.0.0:7000
ports: ports:
- 7000:7000 - 7000:7000
+18 -1
View File
@@ -1,9 +1,26 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
#ENV ALLOWED_HOSTS 'django.tryton.geeraert.eu'
#ENV DEBUG 'True'
ARG ALLOWED_HOSTS
ARG DEBUG
ENV ALLOWED_HOSTS=$ALLOWED_HOSTS
ENV DEBUG=$DEBUG
WORKDIR /code/ WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r requirements.txt
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache) # Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
COPY . ./ COPY . ./
RUN python django_code/manage.py migrate RUN python django_code/manage.py migrate
+1
View File
@@ -13,3 +13,4 @@ celery
redis redis
lxml lxml
requests requests
django-hosts