26 Commits
Author SHA1 Message Date
pierre geeraert 3ff4f98841 fixed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 3s
2026-10-13 23:50:43 +01:00
pi-ux-ce 0a8c337b1e Merge pull request 'Testing' (#51) from testing into main
Dockerfile runner / Explore-Gitea-Actions (push) Failing after 3m38s
Reviewed-on: #51
2026-10-13 22:49:30 +00:00
pierre geeraert 2dac0d1f53 remove tryton reference 2026-10-13 23:48:38 +01:00
pierre geeraert 73b627214d remove tryton reference
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 3s
2026-10-13 23:46:42 +01:00
pierre geeraert c79168453b remove tryton reference
Dockerfile testing runner / Explore-Gitea-Actions (push) Failing after 3m17s
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4s
2026-10-13 23:46:13 +01:00
pi-ux-ce 299f72abca remove gitea.tryton reference
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4s
2026-10-13 20:35:52 +00:00
pi-ux-ce 058125f0b1 Merge pull request 'Testing' (#50) from testing into main
Dockerfile runner / Explore-Gitea-Actions (push) Successful in 6m23s
Reviewed-on: http://gitea.geeraert.eu/pi-ux-ce/Django_kube/pulls/50
2026-10-03 22:28:35 +00:00
pierre geeraert 130b0af8d8 redirect to streaming
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-10-03 23:17:27 +01:00
pierre geeraert 6f7542ef27 change image format
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-10-03 22:01:02 +01:00
pierre geeraert 919d1a3a28 lowercase the alias as well
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
2026-10-03 21:43:09 +01:00
pierre geeraert 3c4c32e72d lowercase the sanitized name 2026-10-03 21:25:11 +01:00
pierre.geeraert 3294e70b3f add rest framework authentication
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-22 10:01:09 +01:00
pierre.geeraert 5908d8d282 views to add or delete ingress for terraform
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-21 22:27:22 +01:00
pierre.geeraert 32f8251a90 enable ingress module
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-21 17:34:07 +01:00
pierre geeraert a3fec86eae increase size poster
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-09-17 22:49:47 +01:00
pi-ux-ce 672edccd70 Merge pull request 'poster integration' (#48) from testing into main
Dockerfile runner / Explore-Gitea-Actions (push) Successful in 2m0s
Reviewed-on: http://gitea.geeraert.eu/pi-ux-ce/Django_kube/pulls/48
2026-09-17 21:44:13 +00:00
pierre geeraert f188e25453 add poster function
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
2026-09-17 22:33:11 +01:00
pierre.geeraert d4a72ebf5d we can have logos
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-16 14:38:11 +01:00
pierre.geeraert 4492db4185 cleanup
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-16 13:23:41 +01:00
pierre.geeraert 015edcd63d universal method
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-16 11:25:36 +01:00
pierre.geeraert aaad6b2b7e add exmaple
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
2026-09-15 18:23:16 +01:00
pierre.geeraert 3b6eccba80 create universal admin class
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-09-15 18:22:03 +01:00
pi-ux-ce 44b730dbfc Merge pull request 'more pretty' (#47) from testing into main
Dockerfile runner / Explore-Gitea-Actions (push) Successful in 48s
Reviewed-on: http://gitea.geeraert.eu/pi-ux-ce/Django_kube/pulls/47
2026-09-15 10:40:20 +00:00
pierre.geeraert ea4ebb0de0 more pretty
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-09-15 11:39:05 +01:00
pi-ux-ce 3b3e82f16a Merge pull request 'change timezone to London' (#46) from testing into main
Dockerfile runner / Explore-Gitea-Actions (push) Successful in 44s
Reviewed-on: http://gitea.geeraert.eu/pi-ux-ce/Django_kube/pulls/46
2026-09-15 10:25:57 +00:00
pierre.geeraert 1430afe600 change timezone to London
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
2026-09-15 11:03:48 +01:00
36 changed files with 278 additions and 170 deletions
+9 -9
View File
@@ -15,9 +15,9 @@ jobs:
env: env:
RUNNER_TOOL_CACHE: /toolcache RUNNER_TOOL_CACHE: /toolcache
DEBUG: True DEBUG: True
ALLOWED_HOSTS: "django.tryton.geeraert.eu" ALLOWED_HOSTS: "django.geeraert.eu"
container: container:
image: gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6 image: gitea.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6
volumes: volumes:
- act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default - act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default
runs-on: host-runner runs-on: host-runner
@@ -59,7 +59,7 @@ jobs:
- name: Login to gitea - name: Login to gitea
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: gitea.tryton.geeraert.eu registry: gitea.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }} username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }} password: ${{ secrets.PASSWORD_GITEA }}
@@ -67,16 +67,16 @@ jobs:
run: | run: |
docker build \ docker build \
-f infra/production/dockerfile \ -f infra/production/dockerfile \
--build-arg ALLOWED_HOSTS='django.tryton.geeraert.eu' \ --build-arg ALLOWED_HOSTS='django.geeraert.eu' \
--build-arg DEBUG='True' \ --build-arg DEBUG='True' \
-t gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest \ -t gitea.geeraert.eu/pi-ux-ce/django-python:latest \
-t gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} \ -t gitea.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} \
. .
- name: Push image - name: Push image
run: | run: |
docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest docker push gitea.geeraert.eu/pi-ux-ce/django-python:latest
docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }} docker push gitea.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }}
- 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
@@ -91,7 +91,7 @@ jobs:
run: | run: |
curl -X PUT -H "Content-Type: application/json" \ curl -X PUT -H "Content-Type: application/json" \
--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.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 - name: backup git for future use
@@ -36,7 +36,7 @@ jobs:
- name: Login to gitea - name: Login to gitea
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: gitea.tryton.geeraert.eu registry: gitea.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }} username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }} password: ${{ secrets.PASSWORD_GITEA }}
@@ -44,23 +44,23 @@ jobs:
run: | run: |
docker build \ docker build \
-f infra/testing/dockerfile \ -f infra/testing/dockerfile \
--build-arg ALLOWED_HOSTS='django-testing.tryton.geeraert.eu' \ --build-arg ALLOWED_HOSTS='django-testing.geeraert.eu' \
--build-arg DEBUG='True' \ --build-arg DEBUG='True' \
--build-arg CACHE_BUST=${{ env.next_version }} \ --build-arg CACHE_BUST=${{ env.next_version }} \
-t gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:latest \ -t gitea.geeraert.eu/pi-ux-ce/django-testing:latest \
-t gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }} \ -t gitea.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }} \
. .
- name: Push image - name: Push image
run: | run: |
docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:latest docker push gitea.geeraert.eu/pi-ux-ce/django-testing:latest
docker push gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }} docker push gitea.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }}
- name: update version in the variable - name: update version in the variable
run: | run: |
curl -X PUT -H "Content-Type: application/json" \ curl -X PUT -H "Content-Type: application/json" \
--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_TESTING \ https://gitea.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION_TESTING \
-d "{\"Value\":\"$next_version\"}" -d "{\"Value\":\"$next_version\"}"
- name: Rollout Django to force pulling the new image - name: Rollout Django to force pulling the new image
+2 -2
View File
@@ -72,14 +72,14 @@ export bitwarden_organization_id=""
``` ```
cd existing_repo cd existing_repo
git remote add origin https://gitlab.tryton.geeraert.eu/pierre/django_kube.git git remote add origin https://gitea.geeraert.eu/pi-ux-ce/Django_kube.git
git branch -M main git branch -M main
git push -uf origin main git push -uf origin main
``` ```
## Integrate with your tools ## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.tryton.geeraert.eu/pierre/django_kube/-/settings/integrations) - [ ] [Set up project integrations](https://gitlab.geeraert.eu/pierre/django_kube/-/settings/integrations)
## Collaborate with your team ## Collaborate with your team
+19 -1
View File
@@ -59,7 +59,25 @@ class betaserieUtils():
show_id = response.json()['shows'][0]['id'] show_id = response.json()['shows'][0]['id']
return show_id return show_id
def poster_serie(self,serie_name,verbose=False):
#
# Usage
# poster_url = beta.poster_serie("The simpsons")
# poster_url = beta.poster_serie("The simpsons",verbose=True)
#
url = "https://api.betaseries.com/shows/search?title="+serie_name
response = requests.request("GET", url, headers=self.headers, data=self.payload)
if verbose:
print("Url request: "+str(url))
print(response.text)
poster_url = response.json()['shows'][0]['images']['show']
return poster_url
def identify_episode(self,show_id,episode_number,verbose=False): def identify_episode(self,show_id,episode_number,verbose=False):
# #
# Usage # Usage
+2 -2
View File
@@ -12,9 +12,9 @@ class bitwardenUtils():
client = BitwardenClient( client = BitwardenClient(
client_settings_from_dict( client_settings_from_dict(
{ {
"apiUrl": os.getenv("API_URL", "https://bitwarden.tryton.geeraert.eu/api"), "apiUrl": os.getenv("API_URL", "https://bitwarden.geeraert.eu/api"),
"deviceType": DeviceType.SDK, "deviceType": DeviceType.SDK,
"identityUrl": os.getenv("IDENTITY_URL", "https://bitwarden.tryton.geeraert.eu/identity"), "identityUrl": os.getenv("IDENTITY_URL", "https://bitwarden.geeraert.eu/identity"),
"userAgent": "Python", "userAgent": "Python",
} }
) )
+11 -26
View File
@@ -1,14 +1,12 @@
from django.contrib import admin,messages from django.contrib import admin,messages
from django.utils.translation import ngettext from django.utils.translation import ngettext
from .models import Deployment_Data,Schedule_Day_Data,Schedule_Week_Data,Namespace_Data from .models import Deployment_Data,Schedule_Day_Data,Schedule_Week_Data,Namespace_Data,Ingress_Data
from .utils import import_namespace,import_deployment,generate_default_day_schedule,generate_default_week_schedule,Check_server_supposed_XXX,retrieve_and_apply from .utils import import_namespace,import_deployment,generate_default_day_schedule,generate_default_week_schedule,Check_server_supposed_XXX,retrieve_and_apply
from apps.kubernetes_connection.utils import scale_up,scale_down from apps.kubernetes_connection.utils import scale_up,scale_down
from admin_extra_buttons.api import ExtraButtonsMixin, button from admin_extra_buttons.api import button
from import_export.admin import ImportExportModelAdmin from core.admin import UniversalModelAdmin
DB = 'cloudmanager_db'
@admin.action(description="scale up") @admin.action(description="scale up")
def scale_up_deploy(modeladmin, request, queryset): def scale_up_deploy(modeladmin, request, queryset):
@@ -68,25 +66,8 @@ class ActiveAtHourFilter(admin.SimpleListFilter):
return queryset return queryset
class MultiDBModelAdmin(admin.ModelAdmin):
"""Base class that pins all admin operations to DB."""
db = DB
def get_queryset(self, request):
return super().get_queryset(request).using(self.db)
def save_model(self, request, obj, form, change):
obj.save(using=self.db)
def delete_model(self, request, obj):
obj.delete(using=self.db)
def delete_queryset(self, request, queryset):
queryset.using(self.db).delete()
@admin.register(Deployment_Data) @admin.register(Deployment_Data)
class DeploymentDataAdmin(ImportExportModelAdmin,ExtraButtonsMixin, MultiDBModelAdmin): class DeploymentDataAdmin(UniversalModelAdmin):
list_display = ('name', 'namespace', 'schedule_week', 'schedule_day', 'replicas') list_display = ('name', 'namespace', 'schedule_week', 'schedule_day', 'replicas')
list_filter = (ActiveAtHourFilter,) list_filter = (ActiveAtHourFilter,)
actions = [Check_server_supposed_False,Check_server_supposed_true,scale_up_deploy,scale_down_deploy] actions = [Check_server_supposed_False,Check_server_supposed_true,scale_up_deploy,scale_down_deploy]
@@ -104,7 +85,7 @@ class DeploymentDataAdmin(ImportExportModelAdmin,ExtraButtonsMixin, MultiDBModel
self.message_user(request, 'Deployments imported') self.message_user(request, 'Deployments imported')
@admin.register(Schedule_Day_Data) @admin.register(Schedule_Day_Data)
class ScheduleDayAdmin(ImportExportModelAdmin,ExtraButtonsMixin,MultiDBModelAdmin): class ScheduleDayAdmin(UniversalModelAdmin):
list_display = ['name_schedule'] + [f'state_at_{h}' for h in range(24)] list_display = ['name_schedule'] + [f'state_at_{h}' for h in range(24)]
@button() @button()
def generate_default_day_schedule_admin(self, request): def generate_default_day_schedule_admin(self, request):
@@ -113,7 +94,7 @@ class ScheduleDayAdmin(ImportExportModelAdmin,ExtraButtonsMixin,MultiDBModelAdmi
self.message_user(request, 'Created default schedules') self.message_user(request, 'Created default schedules')
@admin.register(Schedule_Week_Data) @admin.register(Schedule_Week_Data)
class ScheduleWeekAdmin(ImportExportModelAdmin,ExtraButtonsMixin,MultiDBModelAdmin): class ScheduleWeekAdmin(UniversalModelAdmin):
list_display = ( list_display = (
'name_schedule', 'name_schedule',
'state_Monday', 'state_Tuesday', 'state_Wednesday', 'state_Monday', 'state_Tuesday', 'state_Wednesday',
@@ -127,7 +108,7 @@ class ScheduleWeekAdmin(ImportExportModelAdmin,ExtraButtonsMixin,MultiDBModelAdm
@admin.register(Namespace_Data) @admin.register(Namespace_Data)
class NamespaceAdmin(ImportExportModelAdmin,ExtraButtonsMixin, MultiDBModelAdmin): class NamespaceAdmin(UniversalModelAdmin):
list_display = ('namespace',) list_display = ('namespace',)
@@ -136,3 +117,7 @@ class NamespaceAdmin(ImportExportModelAdmin,ExtraButtonsMixin, MultiDBModelAdmin
# your business logic here # your business logic here
import_namespace() import_namespace()
self.message_user(request, 'Namespaces imported') self.message_user(request, 'Namespaces imported')
@admin.register(Ingress_Data)
class IngressAdmin(UniversalModelAdmin):
list_display = ('url','namespace')
@@ -0,0 +1,22 @@
# Generated by Django 4.2.30 on 2026-09-21 16:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cloudmanager', '0012_alter_deployment_data_do_not_touch_until'),
]
operations = [
migrations.CreateModel(
name='Ingress_Data',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.CharField(max_length=100)),
('namespace', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cloudmanager.namespace_data')),
],
),
]
@@ -0,0 +1,18 @@
# Generated by Django 4.2.30 on 2026-09-21 21:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cloudmanager', '0013_ingress_data'),
]
operations = [
migrations.AlterField(
model_name='ingress_data',
name='namespace',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
+6
View File
@@ -62,3 +62,9 @@ class Namespace_Data(models.Model):
#deployments = models.ForeignKey(Schedule_Week_Data,null=True, blank=True, on_delete=models.SET_NULL) #deployments = models.ForeignKey(Schedule_Week_Data,null=True, blank=True, on_delete=models.SET_NULL)
class Meta: class Meta:
db_table = 'namespace' db_table = 'namespace'
def __str__(self):
return self.namespace
class Ingress_Data(models.Model):
url = models.CharField(max_length=100)
namespace = models.CharField(max_length=100,null=True, blank=True)
+5 -1
View File
@@ -16,7 +16,7 @@ Including another URLconf
""" """
from django.urls import path from django.urls import path
from .views import hello,import_namespace_view,retrieve_and_apply_view,scale_up_gui,scale_down_gui from .views import hello,import_namespace_view,retrieve_and_apply_view,scale_up_gui,scale_down_gui,add_ingress,delete_ingress
urlpatterns = [ urlpatterns = [
@@ -26,4 +26,8 @@ urlpatterns = [
path('retrieve_and_apply_view', retrieve_and_apply_view, name='retrieve_and_apply_view'), path('retrieve_and_apply_view', retrieve_and_apply_view, name='retrieve_and_apply_view'),
path('scale_up/<str:namespace_name>/<str:deploy_name>', scale_up_gui), path('scale_up/<str:namespace_name>/<str:deploy_name>', scale_up_gui),
path('scale_down/<str:namespace_name>/<str:deploy_name>', scale_down_gui), path('scale_down/<str:namespace_name>/<str:deploy_name>', scale_down_gui),
path('add_ingress', add_ingress),
path('delete_ingress', delete_ingress),
] ]
+1 -1
View File
@@ -140,5 +140,5 @@ def retrieve_and_apply(verbose=False):
output += str("\n") output += str("\n")
print(echo) print(echo)
scale_down(namespace_name=server[1],deploy_name=server[0]) scale_down(namespace_name=server[1],deploy_name=server[0])
print("------------------------------------------")
return output return output
+44 -1
View File
@@ -2,10 +2,14 @@ from django.http import HttpResponse
from django.shortcuts import render from django.shortcuts import render
from datetime import timedelta from datetime import timedelta
from django.utils import timezone from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse
from apps.import_aggregator.import_rest_framework import api_view, authentication_classes, permission_classes,TokenAuthentication,IsAuthenticated,Response,status
from .utils import import_namespace,retrieve_and_apply from .utils import import_namespace,retrieve_and_apply
from apps.kubernetes_connection.utils import scale_up,scale_down from apps.kubernetes_connection.utils import scale_up,scale_down
from .models import Deployment_Data from .models import Deployment_Data,Ingress_Data
def hello(request): def hello(request):
list_schedule = ['schedule1','schedule2'] list_schedule = ['schedule1','schedule2']
@@ -32,3 +36,42 @@ def scale_down_gui(request,namespace_name,deploy_name):
scale_down(namespace_name=namespace_name,deploy_name=deploy_name) scale_down(namespace_name=namespace_name,deploy_name=deploy_name)
return render(request, 'dashboard/shutdown.html', return render(request, 'dashboard/shutdown.html',
{'namespace': namespace_name, 'deployment': deploy_name, 'url': 'https://namespace.com'}) {'namespace': namespace_name, 'deployment': deploy_name, 'url': 'https://namespace.com'})
@api_view(['POST'])
@authentication_classes([TokenAuthentication])
@permission_classes([IsAuthenticated])
def add_ingress(request):
url = request.POST.get('url')
namespace = request.POST.get('namespace')
print("URL: "+str(url))
print("NS: "+str(namespace))
try:
Ingress_Data.objects.update_or_create(url=url,namespace=namespace)
except Exception as exception:
return JsonResponse({"status": "error","reason":str(exception)})
return JsonResponse({"status": "added","url":str(url),"namespace":str(namespace)})
@api_view(['POST'])
@authentication_classes([TokenAuthentication])
@permission_classes([IsAuthenticated])
def delete_ingress(request):
url = request.POST.get('url')
namespace = request.POST.get('namespace')
print("URL: "+str(url))
print("NS: "+str(namespace))
try:
ingress_object = Ingress_Data.objects.filter(url=url,namespace=namespace)
except Exception as exception:
return JsonResponse({"status": "error","reason":str(exception)})
try:
ingress_object.delete()
except Exception as exception:
return JsonResponse({"status": "error","reason":str(exception)})
return JsonResponse({"status": "deleted","url":str(url),"namespace":str(namespace)})
@@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.
@@ -1,46 +0,0 @@
from django.apps import AppConfig
from django.http import HttpResponse
from django.shortcuts import render
import requests
from proxmoxer import ProxmoxAPI
import docker
class BackofficeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'backoffice'
def hello(request):
return HttpResponse('<h1>Start bookstack!</h1>')
def http_call_test(request):
url = 'http://portainer.zeus.geeraert.eu/api/auth/'
myobj = {'Username': 'admin','Password':'Xtm78*CX3mJ54g'}
x = requests.post(url, json = myobj)
print(x.text)
return HttpResponse(x.text)
def proxmox(request):
proxmox = ProxmoxAPI("proxmox.zeus.geeraert.eu", user="root@pam", password="dinner_sl@v3", verify_ssl=False)
return HttpResponse(proxmox)
def docker_call(request,action,id_docker):
print(action)
print(id_docker)
client = docker.from_env()
if action == "start":
print("nous allons start")
client.containers.get(id_docker).start()
if action == "stop":
print("nous allons stop")
client.containers.get(id_docker).stop()
return HttpResponse(client.containers.get(id_docker).status)
@@ -1,3 +0,0 @@
from django.db import models
# Create your models here.
@@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.
@@ -1,8 +0,0 @@
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>')
@@ -0,0 +1,6 @@
from rest_framework.decorators import api_view, authentication_classes, permission_classes
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework import status
+2 -2
View File
@@ -1,9 +1,9 @@
from django.contrib import admin from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from import_export import resources from import_export import resources
from import_export.fields import Field from import_export.fields import Field
from .models import JobData from .models import JobData
from django.utils.text import Truncator from django.utils.text import Truncator
from core.admin import UniversalModelAdmin
# Register your models here. # Register your models here.
@@ -31,7 +31,7 @@ class JobResource(resources.ModelResource):
@admin.register(JobData) @admin.register(JobData)
class JobAdmin(ImportExportModelAdmin): class JobAdmin(UniversalModelAdmin):
list_display = ('job_position','company','URL','status','date_saved','date_applied','type','resume','location','short_description','salary','contact','source') list_display = ('job_position','company','URL','status','date_saved','date_applied','type','resume','location','short_description','salary','contact','source')
#fields = ['job_position','company','URL','status','date_saved','date_applied','type','resume','cover_letter','location','job_description','salary ','contact','source'] #fields = ['job_position','company','URL','status','date_saved','date_applied','type','resume','cover_letter','location','job_description','salary ','contact','source']
resource_classes = [JobResource] resource_classes = [JobResource]
@@ -62,7 +62,7 @@ def nodes(request):
'spec': { 'spec': {
'containers': [{ 'containers': [{
'image': 'gitea.tryton.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1', 'image': 'gitea.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1',
# 'pod-running-timeout': '5m0s', # 'pod-running-timeout': '5m0s',
'name': 'testpython', 'name': 'testpython',
'env': [ 'env': [
@@ -96,7 +96,7 @@ def backup_job(request):
'spec': { 'spec': {
'containers': [{ 'containers': [{
'image': 'gitea.tryton.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1', 'image': 'gitea.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1',
'name': 'testpython', 'name': 'testpython',
'command': ['/bin/sh -c /config/export_bitwarden.sh'], 'command': ['/bin/sh -c /config/export_bitwarden.sh'],
'env': [ 'env': [
@@ -124,8 +124,8 @@ def backup_job_yaml(request,sync_target):
v1 = client.BatchV1Api() v1 = client.BatchV1Api()
yaml_location = { yaml_location = {
"synology" : "https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/synology_pod.yaml", "synology" : "https://gitea.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/synology_pod.yaml",
"openmediavault":"https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/openmediavault_pod.yaml" "openmediavault":"https://gitea.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/openmediavault_pod.yaml"
} }
print(yaml_location[sync_target]) print(yaml_location[sync_target])
url_to_select=yaml_location[sync_target] url_to_select=yaml_location[sync_target]
+4 -5
View File
@@ -1,13 +1,12 @@
from django.contrib import admin from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from import_export import resources from import_export import resources
from django.utils.html import format_html from django.utils.html import format_html
from .models import podcastData from .models import podcastData
from core.admin import UniversalModelAdmin
# Register your models here. # Register your models here.
@admin.register(podcastData) @admin.register(podcastData)
class JobAdmin(ImportExportModelAdmin): class PodcastAdmin(UniversalModelAdmin):
list_display = ('podcast_name','clickable_links','enabled') list_display = ('podcast_name','clickable_links','enabled')
def clickable_links(self, obj): link_field = 'podcast_url'
return format_html('<a href="{}">{}</a>', obj.podcast_url,obj.podcast_url)
+5 -11
View File
@@ -1,13 +1,11 @@
from django.contrib import admin,messages from django.contrib import admin,messages
from django.utils.translation import ngettext from django.utils.translation import ngettext
from django.utils.html import format_html
from django.utils import timezone from django.utils import timezone
from djangoql.admin import DjangoQLSearchMixin
from prompt_toolkit.shortcuts import print_container from prompt_toolkit.shortcuts import print_container
from import_export.admin import ImportExportModelAdmin
from import_export import resources from import_export import resources
from .models import SimpsonsData,simpsons_data_object,urlData from .models import SimpsonsData,urlData
from .utils import mark_episode_watched,unwatch_all_episodes,generate_new_urls_for_episode from .utils import mark_episode_watched,unwatch_all_episodes,generate_new_urls_for_episode
from core.admin import UniversalModelAdmin
# Register your models here. # Register your models here.
@@ -65,19 +63,15 @@ def generate_new_urls(modeladmin, request, queryset):
@admin.register(SimpsonsData) @admin.register(SimpsonsData)
class EpisodeAdmin(DjangoQLSearchMixin,ImportExportModelAdmin): class EpisodeAdmin(UniversalModelAdmin):
list_display = [field.name for field in SimpsonsData._meta.fields if field.name != 'id'] list_display = [field.name for field in SimpsonsData._meta.fields if field.name != 'id']
list_display += ['clickable_links']
list_filter = ['seen','modified_at'] list_filter = ['seen','modified_at']
#list_filter = ['seen'] #list_filter = ['seen']
fields = ['season', 'episode', 'url', 'seen'] fields = ['season', 'episode', 'url', 'seen']
actions = [make_seen,make_unseen,unseen_betaserie,generate_new_urls] actions = [make_seen,make_unseen,unseen_betaserie,generate_new_urls]
search_fields = ['season', 'episode', 'url', 'seen'] search_fields = ['season', 'episode', 'url', 'seen']
djangoql_completion_enabled_by_default = False
def clickable_links(self, obj):
return format_html('<a href="{}">{}</a>', obj.url,obj.url)
def get_queryset(self, request): def get_queryset(self, request):
return super().get_queryset(request).using(DB) return super().get_queryset(request).using(DB)
@@ -91,7 +85,7 @@ class EpisodeAdmin(DjangoQLSearchMixin,ImportExportModelAdmin):
queryset.using(DB).delete() queryset.using(DB).delete()
@admin.register(urlData) @admin.register(urlData)
class urldataAdmin(ImportExportModelAdmin): class urldataAdmin(UniversalModelAdmin):
list_display = ('url_example', 'prefix', 'infix', 'suffix','addedDate') list_display = ('url_example', 'prefix', 'infix', 'suffix','addedDate')
@@ -0,0 +1,19 @@
# Generated by Django 4.2.30 on 2026-09-17 21:26
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('simpsons', '0008_alter_simpsonsdata_modified_at_alter_urldata_infix_and_more'),
]
operations = [
migrations.AlterField(
model_name='simpsonsdata',
name='modified_at',
field=models.DateTimeField(default=datetime.datetime(1969, 12, 31, 23, 0, tzinfo=datetime.timezone.utc)),
),
]
+26 -10
View File
@@ -1,12 +1,26 @@
from django.contrib import admin from django.contrib import admin
from django.utils.html import format_html from django.utils.html import format_html
from import_export.admin import ImportExportModelAdmin
from .models import StreamingSiteTestingData,StreamingRedirectData from .models import StreamingSiteTestingData,StreamingRedirectData
from .utils import full_testing from .utils import full_testing
from apps.website_redirection.utils import redirect_method
from urllib.parse import urlsplit, urlunsplit from urllib.parse import urlsplit, urlunsplit
from core.admin import UniversalModelAdmin
@admin.action(description="Add this show to streaming")
def re_redirect(modeladmin, request, queryset):
output_generated = ""
for query in queryset.values():
print(query)
key = "streaming"
value = query.get('url_display')
output_generated = output_generated + redirect_method(key,value)+";"
modeladmin.message_user(
request,
output_generated
)
@admin.action(description="check the URLs") @admin.action(description="check the URLs")
def check(modeladmin, request, queryset): def check(modeladmin, request, queryset):
for query in queryset: for query in queryset:
@@ -34,14 +48,11 @@ def urlcleaning(modeladmin, request, queryset):
return 0 return 0
@admin.register(StreamingSiteTestingData) @admin.register(StreamingSiteTestingData)
class streamingAdmin(ImportExportModelAdmin): class streamingAdmin(UniversalModelAdmin):
list_display = ['clickable_links','result_colored','newstatus'] list_display = ['clickable_links','result_colored','newstatus']
fields = ['url'] fields = ['url']
actions = [check,urlcleaning] actions = [check,urlcleaning]
def clickable_links(self, obj):
return format_html('<a href="{}">{}</a>', obj.url,obj.url)
def result_colored(self, obj): def result_colored(self, obj):
colors = { colors = {
'REACHABLE': 'green', 'REACHABLE': 'green',
@@ -60,9 +71,12 @@ class streamingAdmin(ImportExportModelAdmin):
#return obj.status #return obj.status
@admin.register(StreamingRedirectData) @admin.register(StreamingRedirectData)
class StreamingRedirectAdmin(ImportExportModelAdmin): class StreamingRedirectAdmin(UniversalModelAdmin):
list_display = ['name','season','episode','randomViewing','clickable_links','addedDate','alias'] list_display = ['name','image_tag','season','episode','randomViewing','clickable_links','addedDate','alias']
actions = [re_redirect]
#fields = ['name','season','episode','url_example','prefix','infix','suffix','alias','randomViewing','seasonInformation'] #fields = ['name','season','episode','url_example','prefix','infix','suffix','alias','randomViewing','seasonInformation']
fieldsets = ( fieldsets = (
( (
@@ -77,8 +91,10 @@ class StreamingRedirectAdmin(ImportExportModelAdmin):
( (
'Information', { 'Information', {
"classes": ["collapse"], "classes": ["collapse"],
'fields': ('seasonInformation','alias','betaserieShowId','maximumNumberSeason') 'fields': ('seasonInformation','alias','betaserieShowId','maximumNumberSeason','poster_url')
}), }),
) )
def clickable_links(self, obj): link_field = 'url_display'
return format_html('<a href="{}">{}</a>', obj.url_display,obj.url_display)
def image_tag(self,obj):
return format_html('<img src="{0}" style="width: 355px; height:200px;" />'.format(obj.poster_url))
@@ -0,0 +1,18 @@
# Generated by Django 4.2.30 on 2026-09-17 21:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('streaming', '0014_remove_streamingredirectdata_url_example_and_more'),
]
operations = [
migrations.AddField(
model_name='streamingredirectdata',
name='poster_url',
field=models.CharField(blank=True, help_text='poster URL', max_length=1000, null=True),
),
]
+9 -8
View File
@@ -21,7 +21,7 @@ class StreamingRedirectData(models.Model):
name = models.CharField(primary_key=True,max_length=1000, help_text="Name of the show") name = models.CharField(primary_key=True,max_length=1000, help_text="Name of the show")
season = models.IntegerField(null=False,default=1) season = models.IntegerField(null=False,default=1)
episode = models.IntegerField(null=False,default=0) episode = models.IntegerField(null=False,default=0)
url_display = models.CharField(max_length=1000, help_text="https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=18&episode=5",blank=True, null=True) url_display = models.CharField(max_length=1000, help_text="https://streaming.geeraert.eu/office",blank=True, null=True)
prefix = models.CharField(max_length=1000, help_text="https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=",blank=True, null=True) prefix = models.CharField(max_length=1000, help_text="https://www.1shows.org/tv/456-the-simpsons?streaming=true&season=",blank=True, null=True)
infix = models.CharField(max_length=1000, help_text="&episode=",blank=True, null=True) infix = models.CharField(max_length=1000, help_text="&episode=",blank=True, null=True)
suffix = models.CharField(max_length=1000, help_text="" ,blank=True, null=True) suffix = models.CharField(max_length=1000, help_text="" ,blank=True, null=True)
@@ -31,28 +31,27 @@ class StreamingRedirectData(models.Model):
betaserieShowId = models.IntegerField(null=True,blank=True) betaserieShowId = models.IntegerField(null=True,blank=True)
maximumNumberSeason = models.IntegerField(null=True,blank=True) maximumNumberSeason = models.IntegerField(null=True,blank=True)
randomViewing = models.BooleanField(default=False) randomViewing = models.BooleanField(default=False)
poster_url = models.CharField(max_length=1000, help_text="poster URL",blank=True, null=True)
def sanitize(self, name): def sanitize(self, name):
return name.replace(" ", "") return name.replace(" ", "").lower()
def season_information(self, serie_name): def season_information(self, serie_name):
betaserie = betaserieUtils() betaserie = betaserieUtils()
print(serie_name)
print(betaserie.identify_serie(serie_name,True))
return betaserie.series_information(betaserie.identify_serie(serie_name))[0] return betaserie.series_information(betaserie.identify_serie(serie_name))[0]
def maximum_Number_Season(self, serie_name): def maximum_Number_Season(self, serie_name):
betaserie = betaserieUtils() betaserie = betaserieUtils()
print(serie_name)
print(betaserie.identify_serie(serie_name))
return betaserie.series_information(betaserie.identify_serie(serie_name))[1] return betaserie.series_information(betaserie.identify_serie(serie_name))[1]
def betaserie_show_id(self,serie_name): def betaserie_show_id(self,serie_name):
betaserie = betaserieUtils() betaserie = betaserieUtils()
print(serie_name)
print(betaserie.identify_serie(serie_name))
return betaserie.identify_serie(serie_name) return betaserie.identify_serie(serie_name)
def betaserie_poster_url(self,serie_name):
betaserie = betaserieUtils()
return betaserie.poster_serie(serie_name)
def url_display_set(self,alias): def url_display_set(self,alias):
if ENVIRONMENT == "PRODUCTION": if ENVIRONMENT == "PRODUCTION":
url = "https://streaming.geeraert.eu/" url = "https://streaming.geeraert.eu/"
@@ -73,6 +72,8 @@ class StreamingRedirectData(models.Model):
self.maximumNumberSeason = self.maximum_Number_Season(self.name) self.maximumNumberSeason = self.maximum_Number_Season(self.name)
if not self.url_display: if not self.url_display:
self.url_display = self.url_display_set(self.alias) self.url_display = self.url_display_set(self.alias)
if not self.poster_url:
self.poster_url = self.betaserie_poster_url(self.name)
super().save(*args, **kwargs) super().save(*args, **kwargs)
class Meta: class Meta:
+3
View File
@@ -15,6 +15,9 @@ def hello(request):
def streamingRedirect(request,alias): def streamingRedirect(request,alias):
#sanitize
alias = alias.lower()
streaming_object = StreamingRedirectData.objects.filter(alias=alias) streaming_object = StreamingRedirectData.objects.filter(alias=alias)
episode = streaming_object.values('episode')[0]['episode'] episode = streaming_object.values('episode')[0]['episode']
@@ -1,7 +1,7 @@
from django.contrib import admin from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from .models import TelegramData from .models import TelegramData
from .utils import telegramUtils from .utils import telegramUtils
from core.admin import UniversalModelAdmin
@admin.action(description="Clear all expired messages") @admin.action(description="Clear all expired messages")
def messages_cleaning(modeladmin, request, queryset): def messages_cleaning(modeladmin, request, queryset):
@@ -10,7 +10,7 @@ def messages_cleaning(modeladmin, request, queryset):
# Register your models here. # Register your models here.
@admin.register(TelegramData) @admin.register(TelegramData)
class JobAdmin(ImportExportModelAdmin): class JobAdmin(UniversalModelAdmin):
list_display = ('message_id','chat_id','description','creation_date','expiration_date') list_display = ('message_id','chat_id','description','creation_date','expiration_date')
actions = [messages_cleaning] actions = [messages_cleaning]
@@ -1,9 +1,7 @@
from django.contrib import admin from django.contrib import admin
from .models import historicalData,redirectData from .models import historicalData,redirectData
from .utils import redirect_method from .utils import redirect_method
from import_export.admin import ImportExportModelAdmin from core.admin import UniversalModelAdmin
from django.utils.html import format_html
# Register your models here. # Register your models here.
@@ -21,16 +19,13 @@ def re_redirect(modeladmin, request, queryset):
output_generated output_generated
) )
@admin.register(historicalData) @admin.register(historicalData)
class historicalAdmin(ImportExportModelAdmin): class historicalAdmin(UniversalModelAdmin):
list_input = (field.name for field in historicalData._meta.fields if field.name != 'id' or field.name != 'url') list_input = (field.name for field in historicalData._meta.fields if field.name != 'id' or field.name != 'url')
list_display = ["clickable_links"] list_display = ["clickable_links"]
list_display.extend(list_input) list_display.extend(list_input)
actions = [re_redirect] actions = [re_redirect]
def clickable_links(self, obj):
return format_html('<a href="{}">{}</a>', obj.url,obj.url)
@admin.register(redirectData) @admin.register(redirectData)
class redirectAdmin(ImportExportModelAdmin): class redirectAdmin(UniversalModelAdmin):
list_display = [field.name for field in redirectData._meta.fields if field.name != 'id'] list_display = [field.name for field in redirectData._meta.fields if field.name != 'id']
list_display += ['clickable_links']
@@ -1,6 +1,5 @@
from django.db import models from django.db import models
from django.contrib import admin from django.contrib import admin
from django.utils.html import format_html
class historicalData(models.Model): class historicalData(models.Model):
url = models.CharField(max_length=1000) url = models.CharField(max_length=1000)
+20
View File
@@ -0,0 +1,20 @@
from import_export.admin import ImportExportModelAdmin
from admin_extra_buttons.api import ExtraButtonsMixin
from django.contrib import admin
from djangoql.admin import DjangoQLSearchMixin
from django.utils.html import format_html
class UniversalModelAdmin(DjangoQLSearchMixin,ImportExportModelAdmin,ExtraButtonsMixin,admin.ModelAdmin):
djangoql_completion_enabled_by_default = True
#Add search fields if you want to have the toggle on/off
# example:
# search_fields = ['season', 'episode', 'url', 'seen']
link_field = 'url'
def clickable_links(self, obj):
url = getattr(obj, self.link_field, None)
return format_html('<a href="{}">{}</a>', url,url)
+5 -1
View File
@@ -54,6 +54,9 @@ INSTALLED_APPS = [
'import_export', 'import_export',
'djangoql', 'djangoql',
'admin_extra_buttons', 'admin_extra_buttons',
'rest_framework',
'rest_framework.authtoken',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@@ -199,7 +202,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC' TIME_ZONE = 'Europe/London'
USE_I18N = True USE_I18N = True
@@ -252,3 +255,4 @@ PROXIES = {
"http" : PROXY_URL, "http" : PROXY_URL,
"https" : PROXY_URL "https" : PROXY_URL
} }
+1 -1
View File
@@ -1,7 +1,7 @@
FROM python:3.12 FROM python:3.12
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
#ENV ALLOWED_HOSTS 'django.tryton.geeraert.eu' #ENV ALLOWED_HOSTS 'django.geeraert.eu'
#ENV DEBUG 'True' #ENV DEBUG 'True'
ARG ALLOWED_HOSTS ARG ALLOWED_HOSTS
+2 -2
View File
@@ -4,7 +4,7 @@ FROM python:3.12
MAINTAINER pi-ux-ce MAINTAINER pi-ux-ce
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV ALLOWED_HOSTS 'django-testing.tryton.geeraert.eu' ENV ALLOWED_HOSTS 'django-testing.geeraert.eu'
ENV DEBUG 'True' ENV DEBUG 'True'
WORKDIR /code/ WORKDIR /code/
@@ -20,7 +20,7 @@ RUN apt-get update && \
# image silently keeps stale code. # image silently keeps stale code.
ARG CACHE_BUST=1 ARG CACHE_BUST=1
RUN echo "cache bust: ${CACHE_BUST}" && \ RUN echo "cache bust: ${CACHE_BUST}" && \
git clone --depth 1 -b testing https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git . git clone --depth 1 -b testing https://gitea.geeraert.eu/pi-ux-ce/Django_kube.git .
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
+1
View File
@@ -17,3 +17,4 @@ xmltodict
whitenoise whitenoise
djangoql djangoql
django-admin-extra-buttons django-admin-extra-buttons
djangorestframework