diff --git a/django_code/dashboard/__pycache__/apps.cpython-313.pyc b/django_code/dashboard/__pycache__/apps.cpython-313.pyc new file mode 100644 index 0000000..42ce838 Binary files /dev/null and b/django_code/dashboard/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code/django_code/__pycache__/__init__.cpython-313.pyc b/django_code/django_code/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..6b4367d Binary files /dev/null and b/django_code/django_code/__pycache__/__init__.cpython-313.pyc differ diff --git a/django_code/django_code/__pycache__/settings.cpython-312.pyc b/django_code/django_code/__pycache__/settings.cpython-312.pyc index 989b4bc..81c0f23 100644 Binary files a/django_code/django_code/__pycache__/settings.cpython-312.pyc and b/django_code/django_code/__pycache__/settings.cpython-312.pyc differ diff --git a/django_code_new/django_code/__pycache__/settings.cpython-312.pyc b/django_code/django_code/__pycache__/settings.cpython-313.pyc similarity index 84% rename from django_code_new/django_code/__pycache__/settings.cpython-312.pyc rename to django_code/django_code/__pycache__/settings.cpython-313.pyc index 989b4bc..80b7b0b 100644 Binary files a/django_code_new/django_code/__pycache__/settings.cpython-312.pyc and b/django_code/django_code/__pycache__/settings.cpython-313.pyc differ diff --git a/django_code/django_code/__pycache__/urls.cpython-312.pyc b/django_code/django_code/__pycache__/urls.cpython-312.pyc index e53a372..6448597 100644 Binary files a/django_code/django_code/__pycache__/urls.cpython-312.pyc and b/django_code/django_code/__pycache__/urls.cpython-312.pyc differ diff --git a/django_code/django_code/__pycache__/urls.cpython-313.pyc b/django_code/django_code/__pycache__/urls.cpython-313.pyc new file mode 100644 index 0000000..aedb6b2 Binary files /dev/null and b/django_code/django_code/__pycache__/urls.cpython-313.pyc differ diff --git a/django_code_new/django_code/__pycache__/wsgi.cpython-312.pyc b/django_code/django_code/__pycache__/wsgi.cpython-313.pyc similarity index 60% rename from django_code_new/django_code/__pycache__/wsgi.cpython-312.pyc rename to django_code/django_code/__pycache__/wsgi.cpython-313.pyc index afc81f3..4c20920 100644 Binary files a/django_code_new/django_code/__pycache__/wsgi.cpython-312.pyc and b/django_code/django_code/__pycache__/wsgi.cpython-313.pyc differ diff --git a/django_code/django_code/settings.py b/django_code/django_code/settings.py index 435f205..a2477ef 100644 --- a/django_code/django_code/settings.py +++ b/django_code/django_code/settings.py @@ -121,3 +121,4 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +# diff --git a/django_code/django_code/urls.py b/django_code/django_code/urls.py index 5ee9bfc..83f261b 100644 --- a/django_code/django_code/urls.py +++ b/django_code/django_code/urls.py @@ -21,6 +21,7 @@ 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 +from kubernetes_connection import apps as kubernetes_connection urlpatterns = [ # path('admin/', admin.site.urls), @@ -41,6 +42,12 @@ urlpatterns = [ path('dashboard/hello/', dashboard.hello), +################## kubernetes_connection##### + path('kubernetes_connection/hello/', kubernetes_connection.hello), + path('kubernetes_connection/nodes/', kubernetes_connection.nodes), + path('kubernetes_connection/backup_job/', kubernetes_connection.backup_job), + path('kubernetes_connection/backup_job_yaml/', kubernetes_connection.backup_job_yaml), + # path('bookstack/', docker_connection.apps.hello), # path('test/', docker_connection.apps.http_call_test), # path('proxmox/', docker_connection.apps.proxmox), diff --git a/django_code_new/django_code/__init__.py b/django_code/kubernetes_connection/__init__.py similarity index 100% rename from django_code_new/django_code/__init__.py rename to django_code/kubernetes_connection/__init__.py diff --git a/django_code/kubernetes_connection/__pycache__/__init__.cpython-312.pyc b/django_code/kubernetes_connection/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..856820b Binary files /dev/null and b/django_code/kubernetes_connection/__pycache__/__init__.cpython-312.pyc differ diff --git a/django_code/kubernetes_connection/__pycache__/__init__.cpython-313.pyc b/django_code/kubernetes_connection/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..8744286 Binary files /dev/null and b/django_code/kubernetes_connection/__pycache__/__init__.cpython-313.pyc differ diff --git a/django_code/kubernetes_connection/__pycache__/apps.cpython-312.pyc b/django_code/kubernetes_connection/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..10af6a1 Binary files /dev/null and b/django_code/kubernetes_connection/__pycache__/apps.cpython-312.pyc differ diff --git a/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc b/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc new file mode 100644 index 0000000..cde7c8c Binary files /dev/null and b/django_code/kubernetes_connection/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code_new/docker_connection/__pycache__/views.cpython-312.pyc b/django_code/kubernetes_connection/__pycache__/views.cpython-312.pyc similarity index 100% rename from django_code_new/docker_connection/__pycache__/views.cpython-312.pyc rename to django_code/kubernetes_connection/__pycache__/views.cpython-312.pyc diff --git a/django_code_new/docker_connection/admin.py b/django_code/kubernetes_connection/admin.py similarity index 100% rename from django_code_new/docker_connection/admin.py rename to django_code/kubernetes_connection/admin.py diff --git a/django_code/kubernetes_connection/apps.py b/django_code/kubernetes_connection/apps.py new file mode 100644 index 0000000..32345cc --- /dev/null +++ b/django_code/kubernetes_connection/apps.py @@ -0,0 +1,115 @@ +from django.apps import AppConfig +from django.http import HttpResponse +from django.shortcuts import render +from django.shortcuts import redirect + +from django.core.files import File +from kubernetes import client, config + +#from django.template.loader import render_to_string +import time +import random +import mimetypes +import ruamel.yaml +import yaml +def hello(request): + return HttpResponse('

Hello k8s!

') + + +def nodes(request): + config.load_kube_config(config_file='/code/kubeconfig') + v1 = client.CoreV1Api() +# v1.list_node() + pod_manifest = { + 'apiVersion': 'v1', + 'kind': 'Pod', + 'metadata': { + 'labels': { + 'bot': 'current-bot' + }, + 'name': 'podname', + 'namespace': 'echo-server' + + }, + 'spec': { + + 'containers': [{ + 'image': 'gitea.tryton.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1', +# 'pod-running-timeout': '5m0s', + 'name': 'testpython', + 'env': [ + {'name': 'env_variable', 'value': 'env_value'}, + ] + }], + 'restartPolicy': 'Always', +# 'serviceAccountName': 'bots-service-account' + } + } + +# print(f'POD MANIFEST:\n{pod_manifest}') + api_response = v1.create_namespaced_pod(body=pod_manifest,namespace='echo-server') + return HttpResponse(api_response) + +def backup_job(request): + config.load_kube_config(config_file='/code/kubeconfig') + v1 = client.CoreV1Api() + #v1 = client.BatchV1Api() +# v1.list_node() + pod_manifest_job = { + 'apiVersion': 'batch/v1', + 'kind': 'Job', + 'metadata': { + 'name': 'bitwarden-backup-django', + 'namespace': 'bwbackup' + + }, + 'spec': { + 'template': { + 'spec': { + + 'containers': [{ + 'image': 'gitea.tryton.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.1', + 'name': 'testpython', + 'command': ['/bin/sh -c /config/export_bitwarden.sh'], + 'env': [ + {'name': 'env_variable', 'value': 'env_value'}, + ], + 'volumeMounts': [ + {'name': 'scripts', 'configMap': [{'name':'bitwarden-export-scripts'},]}, + ] + }], + 'restartPolicy': 'Always', + } + } + } + } + + api_response = v1.create_namespaced_job(body=pod_manifest_job) + return HttpResponse(api_response) + + +#help with yaml import +#https://github.com/kubernetes-client/python/issues/589 + +def backup_job_yaml(request): + config.load_kube_config(config_file='/code/kubeconfig') +# v1 = client.CoreV1Api() + v1 = client.BatchV1Api() + +# v1.list_node() +# pod_manifest_job = { + + with open('/code/pod.yaml') as fo: +# yaml = YAML(typ='rt') + #yaml.load(...) + +# job = ruamel.yaml.load(fo) + job = yaml.safe_load(fo) + + v1.create_namespaced_job( + job['metadata']['namespace'], job, pretty=True + +# _request_timeout=(settings.CONNECTION_TIMEOUT_SECONDS, settings.READ_TIMEOUT_SECONDS + +) + return HttpResponse(job['metadata']['namespace']) diff --git a/django_code_new/docker_connection/__init__.py b/django_code/kubernetes_connection/migrations/__init__.py similarity index 100% rename from django_code_new/docker_connection/__init__.py rename to django_code/kubernetes_connection/migrations/__init__.py diff --git a/django_code_new/docker_connection/models.py b/django_code/kubernetes_connection/models.py similarity index 100% rename from django_code_new/docker_connection/models.py rename to django_code/kubernetes_connection/models.py diff --git a/django_code_new/random_simpsons/templates/my_template.html b/django_code/kubernetes_connection/templates/my_template.html similarity index 100% rename from django_code_new/random_simpsons/templates/my_template.html rename to django_code/kubernetes_connection/templates/my_template.html diff --git a/django_code_new/docker_connection/tests.py b/django_code/kubernetes_connection/tests.py similarity index 100% rename from django_code_new/docker_connection/tests.py rename to django_code/kubernetes_connection/tests.py diff --git a/django_code_new/docker_connection/views.py b/django_code/kubernetes_connection/views.py similarity index 100% rename from django_code_new/docker_connection/views.py rename to django_code/kubernetes_connection/views.py diff --git a/django_code/onenote/__pycache__/apps.cpython-313.pyc b/django_code/onenote/__pycache__/apps.cpython-313.pyc new file mode 100644 index 0000000..184918d Binary files /dev/null and b/django_code/onenote/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code/paperless_django/__pycache__/apps.cpython-313.pyc b/django_code/paperless_django/__pycache__/apps.cpython-313.pyc new file mode 100644 index 0000000..7b4a4b4 Binary files /dev/null and b/django_code/paperless_django/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code/random_simpsons/__pycache__/__init__.cpython-313.pyc b/django_code/random_simpsons/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..f0d463e Binary files /dev/null and b/django_code/random_simpsons/__pycache__/__init__.cpython-313.pyc differ diff --git a/django_code/random_simpsons/__pycache__/apps.cpython-313.pyc b/django_code/random_simpsons/__pycache__/apps.cpython-313.pyc new file mode 100644 index 0000000..2af6b28 Binary files /dev/null and b/django_code/random_simpsons/__pycache__/apps.cpython-313.pyc differ diff --git a/django_code_new/dashboard/__pycache__/apps.cpython-312.pyc b/django_code_new/dashboard/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index 261f917..0000000 Binary files a/django_code_new/dashboard/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/dashboard/apps.py b/django_code_new/dashboard/apps.py deleted file mode 100644 index 4e31abe..0000000 --- a/django_code_new/dashboard/apps.py +++ /dev/null @@ -1,10 +0,0 @@ -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('

Hello dashboard h1>') - diff --git a/django_code_new/db.sqlite3 b/django_code_new/db.sqlite3 deleted file mode 100644 index e69de29..0000000 diff --git a/django_code_new/django_code/__pycache__/__init__.cpython-312.pyc b/django_code_new/django_code/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 879bacb..0000000 Binary files a/django_code_new/django_code/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/django_code/__pycache__/__init__.cpython-39.pyc b/django_code_new/django_code/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index c7e95fe..0000000 Binary files a/django_code_new/django_code/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/django_code_new/django_code/__pycache__/settings.cpython-39.pyc b/django_code_new/django_code/__pycache__/settings.cpython-39.pyc deleted file mode 100644 index 23dd015..0000000 Binary files a/django_code_new/django_code/__pycache__/settings.cpython-39.pyc and /dev/null differ diff --git a/django_code_new/django_code/__pycache__/urls.cpython-312.pyc b/django_code_new/django_code/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index e53a372..0000000 Binary files a/django_code_new/django_code/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/django_code/asgi.py b/django_code_new/django_code/asgi.py deleted file mode 100644 index 61e223c..0000000 --- a/django_code_new/django_code/asgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -ASGI config for django_code project. - -It exposes the ASGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ -""" - -import os - -from django.core.asgi import get_asgi_application - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings') - -application = get_asgi_application() diff --git a/django_code_new/django_code/settings.py b/django_code_new/django_code/settings.py deleted file mode 100644 index 435f205..0000000 --- a/django_code_new/django_code/settings.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Django settings for django_code project. - -Generated by 'django-admin startproject' using Django 4.2.5. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/4.2/ref/settings/ -""" - -from pathlib import Path - -# Build paths inside the project like this: BASE_DIR / 'subdir'. -BASE_DIR = Path(__file__).resolve().parent.parent - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -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! -DEBUG = True - -ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu'] - - -# Application definition - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = 'django_code.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -WSGI_APPLICATION = 'django_code.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/4.2/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } -} - - -# Password validation -# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/4.2/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - -USE_I18N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.2/howto/static-files/ - -STATIC_URL = 'static/' - -# Default primary key field type -# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field - -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/django_code_new/django_code/urls.py b/django_code_new/django_code/urls.py deleted file mode 100644 index 5ee9bfc..0000000 --- a/django_code_new/django_code/urls.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -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 docker_connection import views, apps -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 = [ -# path('admin/', admin.site.urls), - -################### 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//', docker_connection.apps.docker_call), - - -] diff --git a/django_code_new/django_code/wsgi.py b/django_code_new/django_code/wsgi.py deleted file mode 100644 index 7a52be5..0000000 --- a/django_code_new/django_code/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for django_code project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings') - -application = get_wsgi_application() diff --git a/django_code_new/docker_connection/__pycache__/__init__.cpython-312.pyc b/django_code_new/docker_connection/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 7e5ff04..0000000 Binary files a/django_code_new/docker_connection/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/docker_connection/__pycache__/apps.cpython-312.pyc b/django_code_new/docker_connection/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index ff91d2b..0000000 Binary files a/django_code_new/docker_connection/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/docker_connection/apps.py b/django_code_new/docker_connection/apps.py deleted file mode 100644 index 82601dd..0000000 --- a/django_code_new/docker_connection/apps.py +++ /dev/null @@ -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('

Start bookstack!

') - -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) - - - - - - - diff --git a/django_code_new/docker_connection/migrations/__init__.py b/django_code_new/docker_connection/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/django_code_new/manage.py b/django_code_new/manage.py deleted file mode 100644 index 9a915ed..0000000 --- a/django_code_new/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.?""" -import os -import sys - - -def main(): - """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings') - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == '__main__': - main() diff --git a/django_code_new/onenote/__pycache__/apps.cpython-312.pyc b/django_code_new/onenote/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index c91f9a3..0000000 Binary files a/django_code_new/onenote/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/onenote/apps.py b/django_code_new/onenote/apps.py deleted file mode 100644 index ef333eb..0000000 --- a/django_code_new/onenote/apps.py +++ /dev/null @@ -1,10 +0,0 @@ -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('

Hello onenote!

') - diff --git a/django_code_new/paperless_django/__pycache__/apps.cpython-312.pyc b/django_code_new/paperless_django/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index 350d9eb..0000000 Binary files a/django_code_new/paperless_django/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/paperless_django/apps.py b/django_code_new/paperless_django/apps.py deleted file mode 100644 index 2076f02..0000000 --- a/django_code_new/paperless_django/apps.py +++ /dev/null @@ -1,16 +0,0 @@ -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('

Hello paperless!

') - -def redirect_authenticated(request): - - final_url = "https://paperless.tryton.geeraert.eu/" - print(final_url) - - return redirect(str(final_url)) diff --git a/django_code_new/random_simpsons/__init__.py b/django_code_new/random_simpsons/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/django_code_new/random_simpsons/__pycache__/__init__.cpython-312.pyc b/django_code_new/random_simpsons/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 0cd810f..0000000 Binary files a/django_code_new/random_simpsons/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/random_simpsons/__pycache__/apps.cpython-312.pyc b/django_code_new/random_simpsons/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index f93589b..0000000 Binary files a/django_code_new/random_simpsons/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/random_simpsons/__pycache__/views.cpython-312.pyc b/django_code_new/random_simpsons/__pycache__/views.cpython-312.pyc deleted file mode 100644 index e6faa35..0000000 Binary files a/django_code_new/random_simpsons/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/django_code_new/random_simpsons/admin.py b/django_code_new/random_simpsons/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/django_code_new/random_simpsons/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/django_code_new/random_simpsons/apps.py b/django_code_new/random_simpsons/apps.py deleted file mode 100644 index 59c6272..0000000 --- a/django_code_new/random_simpsons/apps.py +++ /dev/null @@ -1,68 +0,0 @@ -from django.apps import AppConfig -from django.http import HttpResponse -from django.shortcuts import render -from django.shortcuts import redirect - -from django.core.files import File - -#from django.template.loader import render_to_string -import time -import random -import mimetypes - -def hello(request): - return HttpResponse('

Hello Simpsons!

') -#

href="{{ STATIC_URL }}/files/somefile

) - - -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("

Hello download!

{{ django_file.name }}

bye download!

") -# 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('

Hello !

') - -def simpsons(request): -# simpsons_url = "https://www1.kisscartoon.online/episode/the-simpsons-season-"; - simpsons_url = "https://kisscartoon.top/episode/the-simpsons-season-"; - 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] - - #print(simpsons_url) - - random_seasons = random.randint(1, number_of_seasons) - print("random seasons: "+ str(random_seasons)) - - #random_seasons-1 because list start at index 0 - print("maximum of episode for this season: "+str(seasons_maximum_number[random_seasons-1])) - - random_episode = random.randint(1, seasons_maximum_number[random_seasons-1]) - - print("random episode: "+ str(random_episode)) - - - final_url = simpsons_url+str(random_seasons)+ "-episode-"+str(random_episode)# - print(final_url) - -# return HttpResponse(str(final_url)) -# time.sleep(10) - return redirect(str(final_url)) diff --git a/django_code_new/random_simpsons/migrations/__init__.py b/django_code_new/random_simpsons/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/django_code_new/random_simpsons/models.py b/django_code_new/random_simpsons/models.py deleted file mode 100644 index 71a8362..0000000 --- a/django_code_new/random_simpsons/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/django_code_new/random_simpsons/tests.py b/django_code_new/random_simpsons/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/django_code_new/random_simpsons/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/django_code_new/random_simpsons/views.py b/django_code_new/random_simpsons/views.py deleted file mode 100644 index dcf84f6..0000000 --- a/django_code_new/random_simpsons/views.py +++ /dev/null @@ -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('

Hello Django!

')