From 1df56ec841089666392f971f21eff965774ca64a Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 23 Jul 2024 17:16:28 +0100 Subject: [PATCH] :boom: rename everything to match django_code instead --- django_code/db.sqlite3 | 0 django_code/django_code/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 142 bytes .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 177 bytes .../__pycache__/settings.cpython-312.pyc | Bin 0 -> 2613 bytes .../__pycache__/settings.cpython-39.pyc | Bin 0 -> 2321 bytes .../__pycache__/urls.cpython-312.pyc | Bin 0 -> 1108 bytes .../__pycache__/wsgi.cpython-312.pyc | Bin 0 -> 642 bytes django_code/django_code/asgi.py | 16 +++ django_code/django_code/settings.py | 123 ++++++++++++++++++ django_code/django_code/urls.py | 32 +++++ django_code/django_code/wsgi.py | 16 +++ django_code/docker_connection/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 146 bytes .../__pycache__/apps.cpython-312.pyc | Bin 0 -> 2331 bytes .../__pycache__/views.cpython-312.pyc | Bin 0 -> 419 bytes django_code/docker_connection/admin.py | 3 + django_code/docker_connection/apps.py | 46 +++++++ .../docker_connection/migrations/__init__.py | 0 django_code/docker_connection/models.py | 3 + django_code/docker_connection/tests.py | 3 + django_code/docker_connection/views.py | 8 ++ django_code/manage.py | 22 ++++ django_code/random_simpsons/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 144 bytes .../__pycache__/apps.cpython-312.pyc | Bin 0 -> 1736 bytes .../__pycache__/views.cpython-312.pyc | Bin 0 -> 419 bytes django_code/random_simpsons/admin.py | 3 + django_code/random_simpsons/apps.py | 34 +++++ .../random_simpsons/migrations/__init__.py | 0 django_code/random_simpsons/models.py | 3 + django_code/random_simpsons/tests.py | 3 + django_code/random_simpsons/views.py | 8 ++ dockerfile | 4 +- 34 files changed, 325 insertions(+), 2 deletions(-) create mode 100644 django_code/db.sqlite3 create mode 100644 django_code/django_code/__init__.py create mode 100644 django_code/django_code/__pycache__/__init__.cpython-312.pyc create mode 100644 django_code/django_code/__pycache__/__init__.cpython-39.pyc create mode 100644 django_code/django_code/__pycache__/settings.cpython-312.pyc create mode 100644 django_code/django_code/__pycache__/settings.cpython-39.pyc create mode 100644 django_code/django_code/__pycache__/urls.cpython-312.pyc create mode 100644 django_code/django_code/__pycache__/wsgi.cpython-312.pyc create mode 100644 django_code/django_code/asgi.py create mode 100644 django_code/django_code/settings.py create mode 100644 django_code/django_code/urls.py create mode 100644 django_code/django_code/wsgi.py create mode 100644 django_code/docker_connection/__init__.py create mode 100644 django_code/docker_connection/__pycache__/__init__.cpython-312.pyc create mode 100644 django_code/docker_connection/__pycache__/apps.cpython-312.pyc create mode 100644 django_code/docker_connection/__pycache__/views.cpython-312.pyc create mode 100644 django_code/docker_connection/admin.py create mode 100644 django_code/docker_connection/apps.py create mode 100644 django_code/docker_connection/migrations/__init__.py create mode 100644 django_code/docker_connection/models.py create mode 100644 django_code/docker_connection/tests.py create mode 100644 django_code/docker_connection/views.py create mode 100755 django_code/manage.py create mode 100644 django_code/random_simpsons/__init__.py create mode 100644 django_code/random_simpsons/__pycache__/__init__.cpython-312.pyc create mode 100644 django_code/random_simpsons/__pycache__/apps.cpython-312.pyc create mode 100644 django_code/random_simpsons/__pycache__/views.cpython-312.pyc create mode 100644 django_code/random_simpsons/admin.py create mode 100644 django_code/random_simpsons/apps.py create mode 100644 django_code/random_simpsons/migrations/__init__.py create mode 100644 django_code/random_simpsons/models.py create mode 100644 django_code/random_simpsons/tests.py create mode 100644 django_code/random_simpsons/views.py diff --git a/django_code/db.sqlite3 b/django_code/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/django_code/django_code/__init__.py b/django_code/django_code/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_code/django_code/__pycache__/__init__.cpython-312.pyc b/django_code/django_code/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d28c5843f0ded8910fa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D2FYbjG zyMbPeh*ijLsOKYs(XRK;INyyPh5QLuH+GZ=#9W|B67lQZNH0JnS#m#~*iX(LM5rUe zJ0I)0{mIZ_Fyi&~+_9*u8|+a;a``P02UKrtKSA%uXMcLU7r%Mvb;rTR+qan`f>Uqf ze9!Fyzd(Oc9$$PtzNicq7o%5QZ;9F74Ptt>8$F0jcY_Dvsczr^lJ@l?L~I5U4H1{_ L?GXw6I&kqX#+zty literal 0 HcmV?d00001 diff --git a/django_code/django_code/__pycache__/settings.cpython-39.pyc b/django_code/django_code/__pycache__/settings.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..23dd015eef2f2c329c4933590dba2c2fe21deb9a GIT binary patch literal 2321 zcmb7FOK;mo5T<16VZ}}yJFg~a!6IlAB^8MzZXQLEh8AgCh+Z%$yXBz-rCrJE@Ri-A z9rN0MQRL9(P@w%uy!O;T&_hu)9a6F_%K_^0vE1F6`DXUpnWeM1SP|g*aZSX(EeOKz z>0tUQ!r%qG>=$T|Um zIjaKSB785PlC^+9f<%%T|Em#-PBD#o+=+Z3#ExpZ?oOKCZM$4dc z8LedPm8`u=awE}NLf5Rz=(@EG-d5nff^Jw>(MQ%bbkh*3x15JLL8xeZjz0<{hB+tx zh)KhMN)+#7%CH^M;LV`~?H(R*xl-A{KBf-GNa`O-cTi?obC5@TiE)SWiRK+CVt^%0 zpjYLG@|R$}4#-|Wu|#}u;yIiIz61~7CE%90_zQ>vS9UoM*;k5!f&r7qK8_+71fGI@ z1ppNugk->!qp+1RJm1CAFmheVC5%hK@MKwzkH8ToRN8mk2($m=i{jywqd#Dag=#Jl zyAI!t*Cs3wpW#77aqY>2&#Lxqd^>nnL+-=i`^VleLbZGJ;Qs3Ur~8LBAKmN6m|*(( z-AAiVSPP$-)na^Q3?mN$pHtG8Gg9M~+1Us@-kOL- z1Qs`EEjVnxcl>BZ z`IyTO7#zu}Vp3XD>o4`TmWWzo%Sg&9b#SFa}}+lHgu zwv$o_2c}E!2~3UkyKg@O>62q>Xx1?Y;`)O-P>x`JMHyk-qc&& zrfTX&vb1AtG*bO$qpqg;l+0_Ysitm?XVh>9*B@lqvTh;KqZe?WCCYOba460lA)fPnI=(UF|hZ8<0EpdP8q&zY6qI zU?FS%+E#W04=W+5MQ>^Ytc(a(w5-DIQ(2z=5?^7eoSr;AI{G2X;bBt#8nz^I@pJgk z3v3e_abaO@sU*&cd9hHQFIPk{pMyJJexLtad@nAErF2~U2l|WR`@A^y{wc12ReBf2 F!oQn+Au#{| literal 0 HcmV?d00001 diff --git a/django_code/django_code/__pycache__/urls.cpython-312.pyc b/django_code/django_code/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c55b59003dca84e5abd91573a2eecc0135be4751 GIT binary patch literal 1108 zcmb7D&ui2`6rN<0b~j5~p-==pjHlf|&0y~2bCCd_1Ow>QCq z$KE`87XJsqtDZ^^g@7mV;H{;2>B%?Qgsufa2a>!@zI^X{-<$V!VZlSNK7V;X_~an; z-MrMxt%9>X2;L!z`iNT8PAzWtZOg=sw85ReQ^ro}^0~fiAsaD=y3E~Ktcfn3AMI&e zV&(vI<>Ff%)tI5(Z%yX?X7mPr@?JiFieo7T$#ATqJdpwqq{52rGNoCVDY-YnaNl8Z z9(dl15yM+!m1a?%GbQvEP7|GDCC53_7`QafCEiWgD;?ksAmUOnoCx6LQ}!%nk!Dyk z*7Go|QJ!bIM+lX%4(LuKhO$l2WwKL@LFVrT`f)dXSLg@91<|F&eSm* zC2z;~y`ScU`c~malqUiL$2e}D;E~>+8?iK%WWS}MnOX`>p7~xeABJ#b!mwDZR6=pN zO14!4$cpxibOrN=iX{~ZDtTCwC^LnHTXGl8dbeoLwEhD+0}ML%Nh~QNf6T z@Ziyl7wJdwQc(~V1Vub}Q*!Ic*`}ebb9nRKJbr)PV?M5|5adqh{k!-LM(Af%EKcn_ zneDjbEfQ#e1Qwpe1MF^JdYM1)F#V5l7dox`}4d`AN1hH{!| zu`A)8bOe%4c#)p96wg4=;gILKOe1bnt%gI#x9PMpT>wp$lg-W=R4YfG8XBh(?otCl zM%L!$5o1C}CJ5PG54}%A6r1z|50&=OR87Ry4Op-G4yBfCF#^tR9Y*@X8 zmu!@+_2*A}ovpCHvAx~xb^77Ut@T$gHV#@>b`Th_HdTpf*UNesIwN6NdfJpX=5~U} zO%YV&h419bI;crnXjKvi6cF=WY0JhX-4AG1`8sX0NDE+B#Qv)))*zprE/', docker_connection.apps.docker_call), + + +] diff --git a/django_code/django_code/wsgi.py b/django_code/django_code/wsgi.py new file mode 100644 index 0000000..7a52be5 --- /dev/null +++ b/django_code/django_code/wsgi.py @@ -0,0 +1,16 @@ +""" +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/docker_connection/__init__.py b/django_code/docker_connection/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_code/docker_connection/__pycache__/__init__.cpython-312.pyc b/django_code/docker_connection/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e5ff04a8f233f35f99a89ea3fc2f3422179a67f GIT binary patch literal 146 zcmX@j%ge<81RhJ~r-A6lAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdWvHK=pOUIylv+1{Q+K-YeIT>M8t=r8fnpjagAQV>>=iA-#xGR|WxWXYDwa$XK(*;dN2d@PU^ zJD!h&K4!O-)w~+5CGrUgT}5X69x~eqUXw%L`J}1dL-~}M0G>9Jz}w9f@Qy_#oBmrE zWwD=_@VrUaDO$5nv7f%ix%VYup6f6I$~YyCN$50)$s5#ND7y<2H$E?f{zHzVkKF?x ztRjN)*hG2B#Ch42^2(x|RebHTQJ8m&MXNxA$Jw>}B z#5ZSh1=uM^$sIx&(LFfMV$O66^MvXJ*KtUJTdt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in.py b/django_code/docker_connection/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/django_code/docker_connection/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/django_code/docker_connection/apps.py b/django_code/docker_connection/apps.py new file mode 100644 index 0000000..82601dd --- /dev/null +++ b/django_code/docker_connection/apps.py @@ -0,0 +1,46 @@ +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/docker_connection/migrations/__init__.py b/django_code/docker_connection/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_code/docker_connection/models.py b/django_code/docker_connection/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/django_code/docker_connection/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/django_code/docker_connection/tests.py b/django_code/docker_connection/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/django_code/docker_connection/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/django_code/docker_connection/views.py b/django_code/docker_connection/views.py new file mode 100644 index 0000000..dcf84f6 --- /dev/null +++ b/django_code/docker_connection/views.py @@ -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('

Hello Django!

') diff --git a/django_code/manage.py b/django_code/manage.py new file mode 100755 index 0000000..9a915ed --- /dev/null +++ b/django_code/manage.py @@ -0,0 +1,22 @@ +#!/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/random_simpsons/__init__.py b/django_code/random_simpsons/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_code/random_simpsons/__pycache__/__init__.cpython-312.pyc b/django_code/random_simpsons/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc5749278fea00b14725686bb7ef64a4a904bdf0 GIT binary patch literal 144 zcmX@j%ge<81ZsQdr-A6lAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdrLUiypOUIylvJmtkIamWj77{q769InB4_{r literal 0 HcmV?d00001 diff --git a/django_code/random_simpsons/__pycache__/apps.cpython-312.pyc b/django_code/random_simpsons/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..686dc09b18cd486430f2b0d310d39974a9319e7e GIT binary patch literal 1736 zcmaJ>&2JM&6rc5ecx}f^S^|!%HeF*7btBsXl1d;KDfB|6DovB-VkC^?9mgB?t266{ zShmEW2Un`p-e}cIpo&UGNL3I012}NwvMc9+mgH0}z9Gzs6Eo{wXWgnDY2WC zV4*7bnAhUfIN|b|SQQoF8&FLsaUzp@d_f#i^99CBtXS43rqNWlA28m`Rok}KA+}5d zL$WC#Xe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++ b/django_code/random_simpsons/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/django_code/random_simpsons/apps.py b/django_code/random_simpsons/apps.py new file mode 100644 index 0000000..96787ec --- /dev/null +++ b/django_code/random_simpsons/apps.py @@ -0,0 +1,34 @@ +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 Simpsons!

') + +def simpsons(request): + simpsons_url = "https://www1.kisscartoon.online/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/random_simpsons/migrations/__init__.py b/django_code/random_simpsons/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/django_code/random_simpsons/models.py b/django_code/random_simpsons/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/django_code/random_simpsons/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/django_code/random_simpsons/tests.py b/django_code/random_simpsons/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/django_code/random_simpsons/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/django_code/random_simpsons/views.py b/django_code/random_simpsons/views.py new file mode 100644 index 0000000..dcf84f6 --- /dev/null +++ b/django_code/random_simpsons/views.py @@ -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('

Hello Django!

') diff --git a/dockerfile b/dockerfile index 361d5a6..2b6ddd8 100644 --- a/dockerfile +++ b/dockerfile @@ -3,9 +3,9 @@ FROM python:3 WORKDIR /code/ COPY requirements.txt ./ -COPY reverse_proxy ./ +COPY django_code ./ RUN pip install --no-cache-dir -r requirements.txt COPY . . -CMD [ "python","reverse_proxy/manage.py","runserver","0.0.0.0:8000" ] +CMD [ "python","django_code/manage.py","runserver","0.0.0.0:8000" ]