2 Commits
Author SHA1 Message Date
pi-ux-ce 056104a553 update code 2024-10-22 12:42:28 +01:00
pi-ux-ce 87185595e2 ✨ add CPU and MEMORY limit 2024-07-24 15:37:08 +01:00
12 changed files with 96 additions and 8 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ spec:
resources: resources:
limits: limits:
cpu: 100m cpu: 100m
memory: 50Mi memory: 200Mi
volumes: volumes:
- name: django-python-code - name: django-python-code
persistentVolumeClaim: persistentVolumeClaim:
+10
View File
@@ -0,0 +1,10 @@
from django.apps import AppConfig
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import redirect
import time
import random
def hello(request):
return HttpResponse('<h1>Hello dashboard h1>')
+23 -6
View File
@@ -18,16 +18,33 @@ from django.contrib import admin
from django.urls import path from django.urls import path
#from docker_connection import views, apps #from docker_connection import views, apps
from random_simpsons import apps as random_simpsons from random_simpsons import apps as random_simpsons
from paperless_django import apps as paperless_django
from onenote import apps as onenote
from dashboard import apps as dashboard
urlpatterns = [ urlpatterns = [
# path('admin/', admin.site.urls), # path('admin/', admin.site.urls),
path('hello/', random_simpsons.hello),
# path('bookstack/', docker_connection.apps.hello),
# path('test/', docker_connection.apps.http_call_test),
# path('proxmox/', docker_connection.apps.proxmox),
# path('simpsons/', random_simpsons.hello),
path('simpsons/', random_simpsons.simpsons),
################### Simpsons ###################
path('hello/', random_simpsons.hello),
path('simpsons/', random_simpsons.simpsons),
path('download_file/', random_simpsons.download_file),
################### paperless ###################
path('paperless/hello/', paperless_django.hello),
# path('simpsons/', random_simpsons.simpsons),
################### onenote ###################
path('onenote/hello/', onenote.hello),
################### onenote ###################
path('dashboard/hello/', dashboard.hello),
# path('bookstack/', docker_connection.apps.hello),
# path('test/', docker_connection.apps.http_call_test),
# path('proxmox/', docker_connection.apps.proxmox),
# path('simpsons/', random_simpsons.hello),
# path('docker/<str:action>/<str:id_docker>', docker_connection.apps.docker_call), # path('docker/<str:action>/<str:id_docker>', docker_connection.apps.docker_call),
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
from django.apps import AppConfig
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import redirect
import time
import random
def hello(request):
return HttpResponse('<h1>Hello onenote! <h1>')
+16
View File
@@ -0,0 +1,16 @@
from django.apps import AppConfig
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import redirect
import time
import random
def hello(request):
return HttpResponse('<h1>Hello paperless! <h1>')
def redirect_authenticated(request):
final_url = "https://paperless.tryton.geeraert.eu/"
print(final_url)
return redirect(str(final_url))
+35 -1
View File
@@ -2,14 +2,48 @@ 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 django.core.files import File
#from django.template.loader import render_to_string
import time import time
import random import random
import mimetypes
def hello(request): def hello(request):
return HttpResponse('<h1>Hello Simpsons!</h1>') return HttpResponse('<h1>Hello Simpsons!</h1>')
#<h1>href="{{ STATIC_URL }}/files/somefile</h1>)
def download_file(request):
# fill these variables with real values
fl_path = '/data/download/sonarr'
filename = 'The.Boys.2019.S04E05.2160p.HDR10Plus.WEBRip.6CH.x265.HEVC-PSA.mkv'
# fl = open(fl_path, 'r')
# mime_type, _ = mimetypes.guess_type(fl_path)
# response = HttpResponse(fl, content_type=mime_type)
# response['Content-Disposition'] = "attachment; filename=%s" % filename
some_file = open('/data/kubernetes/Backup/nextcloud/notes/2024-07-28/Course.md', "r")
django_file = File(some_file)
return HttpResponse("<h1>Hello download!</h1><h1><a href='{{ MEDIA_URL }}{{ django_file.relative_path }}'>{{ django_file.name }}</a></h1><h1>bye download!</h1>")
# return response
def download_mo(request,file):
path_to_file = os.path.realpath(file)
response = FileResponse(open(path_to_file, 'rb'))
file_name = file[5:]
response['Content-Disposition'] = 'inline; filename=' + file_name
return response
#def template(request):
# rendered = render_to_string("my_template.html", {"foo": "bar"})
#return HttpResponse('<h1>Hello !</h1>')
def simpsons(request): def simpsons(request):
simpsons_url = "https://www1.kisscartoon.online/episode/the-simpsons-season-"; # simpsons_url = "https://www1.kisscartoon.online/episode/the-simpsons-season-";
simpsons_url = "https://kisscartoon.top/episode/the-simpsons-season-";
number_of_seasons = 35 number_of_seasons = 35
seasons_maximum_number = [13,22,24,22,22,25,25,25,25,23,22,21,22,22,22,21,22,22,20,21,23,22,22,22,22,22,22,22,21,23,22,22,22,22,18] seasons_maximum_number = [13,22,24,22,22,25,25,25,25,23,22,21,22,22,22,21,22,22,20,21,23,22,22,22,22,22,22,22,21,23,22,22,22,22,18]
@@ -0,0 +1 @@
<h1>Hello template!</h1>