From be54738678306108039f34a5408ae66a47fded18 Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Sun, 5 Nov 2023 17:37:42 +0100 Subject: [PATCH] Adds css and js files --- __pycache__/controller.cpython-311.pyc | Bin 533 -> 947 bytes __pycache__/modules.cpython-311.pyc | Bin 609 -> 1142 bytes __pycache__/route.cpython-311.pyc | Bin 230 -> 314 bytes controller.py | 10 ++++++++-- modules.py | 7 ++++++- resources/css/aboute.css | 16 +++++++++++++++ resources/css/style.css | 26 +++++++++++++++++++++++++ resources/views/aboute.html | 13 +++++++++++++ resources/views/welcome.html | 9 ++++++--- route.py | 5 ++++- serveur.py | 1 + 11 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 resources/css/aboute.css create mode 100644 resources/css/style.css create mode 100644 resources/views/aboute.html diff --git a/__pycache__/controller.cpython-311.pyc b/__pycache__/controller.cpython-311.pyc index 6c9d6b7a6faf17d4932011899fd78338ebd97960..0f22dc842863461363e0920fed93a215e43068d9 100644 GIT binary patch literal 947 zcmb7CL2DC16rR~hvgx+bVlAE$izGrk^an^0#6lG$7R5_g2-}?@iR@;=n_Ww89{d5l zwHL3I(u+SOfgEJPlP7P1+M?k}Q2-P4^FNZaUf8FzBjIFNvdU z-MXPMolhoQ)V4o?NH*U=IAsYESq{n1F}l2&!O~7EbB|RN>R4THpnVr?PWe}FUp@Cf z8U@CG2}v&n|J^|CL;th#_jQ=YYLFQJ5Of!UI7s?>;2-oc?Z`hIz1L}?{7?@P&{3pd zcR0#6EZrasQ`L`P9SWcS&6ejz}AzQ}TSuL1zehs10o4Dp6cf=k>&^PQB__RByBRe|3NwgnI<{ z33AG8ESXqUwlSlEwxUY!ES-3bsn-~bhUL?0x|thmnMTUkM|7;M1& literal 533 zcmZ8dKT88K6i@D|ZI4z&XU}u&;s;Ps6hU0-ATH&goR?^ecg^u~vAA_`aT6T+4V2=? z@C#IMC%)n zXT>g$LJ@P&T>~=F8ek3iXL2?!qIbyF zHi%7Zx*OVrx*b`o>>gUdMO->l-^?Ji3GPm7x}w?8g^e~fh{9+XMsCL~bQcM_sJ$f9 zXc1#HjWAqA*=2ZQ`3h&kD{za6fdz*xih<=&YR=Ei2bkAG1%I}Ga2p3Yb1lzy-0Zd% zP%qEifO3|xlO&+|OqK=4tYghNjL)c*1YRlR77~d>{ZV?zd@2|h<_P!a3fz3`vQh3V zFmu$i3OVNb!kpw@mS=Jq-|<{?+<~&^=H${7ui!H?=h=mMCQ|vO;FA27`ULNUx64Bj zZva-&58Wuo?vyA%>E85BVIM)t5%IbTqPA8 z$+F)P+OdnglarH+!at+2)gfU(KWp8CWRDIPWu?}#`UTXbzIhKOE)YW)y0h@CEiR@*| z`dCFDtLkI&;QPL(4vm`!Mtt9hSB&1O(c7T1PbC#dD*GgrXJYMa+dHN5d{u+W%h25W z?g!*E9l?=r6a!8qH6=YRcd(6)0g>8YT_0`;^&!6wF(u7@a6n=h*EE7VYp4a$me-C+ Jk6(ioe*ib-1V8`) delta 325 zcmeyy@sNdYIWI340}!}PaZl}Fn8+s~!~^6_XGmdaVTfW#VGL%_WSVFvrqTu$Enx(y zg@6>s8iv^nDNJ*jQ<#@AF)*xVnpl%A&*E1lP?TDnUs{x$TC87|nOa_~U&X4IQIeZ; zi?K*^vM8fry+yKBOlWaxQE`l8QAtK=QH+0Hs!LI3S!#?^X;EroX-ryCVs2`Aeo?kU zd1_KjZhlH>PHM4ULFFyZg2eRHc#vU5AXkH2Qw(xh1H)Yoo(sI%3s`^z1g!|Z$YFSe z!|($GBa6a@m>WD2*Lh?w@yK4}nS7fu&UC7%8S^$4EB3vNR_uP7j9}wdGJFPkt%wsy h{Nk{I*lSnB3*>@rlAG+vBEiSN%*givL==HS3IMjySWo}} diff --git a/__pycache__/route.cpython-311.pyc b/__pycache__/route.cpython-311.pyc index e63ab29d11e0d179e0e6b43444a402ec428f2e55..4594e41dee87b98a6ae5cca244cd106e077272a7 100644 GIT binary patch literal 314 zcmZ3^%ge<81PvS9Q+t8*V-N=hSfPy1B0$D;h7^Vr#uTO$<`kAWEKv+8ticSLY`1s{ z64O)T6O)rmQ!{gJ2_W<0lZ%UQaU{kU6y+D>7vJK6u|VRQEWa4_tGM)wODc0x^?(9Z zocf8n5S3Nj`iV*Tr6pi-KTXD4Y(*em@k)lzAP4<&ceaWNElw>ej&Uq1$tW#~@y|spz;@oO>TZl zX-=wL5jW6WMj$R$1QH*Z85tQLaERRyRDK{Jbwfzu12-EN(+371(ZB|RMVvrY0Q87p AasU7T literal 230 zcmZ3^%ge<81h1yLr#b=Y#~=<2Fhd!i1%Qm{3@HpLj44cWn4%a`n1dNKS#I$ZB&Mgv zCnhJCre@~c;z*1yD9SI$FVE0<2L>R~zy^Xv>_B+{eM~?R diff --git a/controller.py b/controller.py index 5713883..b322ac6 100644 --- a/controller.py +++ b/controller.py @@ -1,8 +1,14 @@ -from modules import page_html +from modules import page_html, page_css_js def page_accueil(): return page_html('welcome') +def page_accueil_css(): + return page_css_js('style','css') + def a_propos(): - return "À propos de nous!" \ No newline at end of file + return page_html('aboute') + +def a_propos_css(): + return page_css_js('aboute','css') \ No newline at end of file diff --git a/modules.py b/modules.py index 8fe4bc7..93d060f 100644 --- a/modules.py +++ b/modules.py @@ -1,4 +1,9 @@ def page_html(page): - with open(f'resources/views/{page}.html', 'r') as fichier_html: + with open(f'resources/views/{page}.html', 'r', encoding='utf-8') as fichier_html: res = fichier_html.read() + return res + +def page_css_js(page, type): + with open(f'resources/{type}/{page}.{type}', 'r', encoding='utf-8') as fichier_css_js: + res = fichier_css_js.read() return res \ No newline at end of file diff --git a/resources/css/aboute.css b/resources/css/aboute.css new file mode 100644 index 0000000..6edf63f --- /dev/null +++ b/resources/css/aboute.css @@ -0,0 +1,16 @@ +body { + font-family: Arial, sans-serif; + background-color: #f2f2f2; + text-align: center; + margin: 0; + padding: 0; +} + +h1 { + color: #333; +} + +p { + font-size: 18px; + color: #c40000; +} \ No newline at end of file diff --git a/resources/css/style.css b/resources/css/style.css new file mode 100644 index 0000000..ad09b4b --- /dev/null +++ b/resources/css/style.css @@ -0,0 +1,26 @@ +body { + font-family: Arial, sans-serif; + background-color: #f2f2f2; + text-align: center; + margin: 0; + padding: 0; +} + +h1, +h2 { + color: #333; +} + +p { + font-size: 18px; + color: #666; +} + +a { + color: #007bff; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} diff --git a/resources/views/aboute.html b/resources/views/aboute.html new file mode 100644 index 0000000..0bcc645 --- /dev/null +++ b/resources/views/aboute.html @@ -0,0 +1,13 @@ + + + + + + Document + + + +

Aboute

+

c'est une page

+ + \ No newline at end of file diff --git a/resources/views/welcome.html b/resources/views/welcome.html index ac65b3c..f5f23a4 100644 --- a/resources/views/welcome.html +++ b/resources/views/welcome.html @@ -3,10 +3,13 @@ - Document + Bienvenue sur PyRoute + -

Hello, World!

- About +

Ça fonctionne !

+

Bienvenue sur PyRoute

+

Ceci est la page d'accueil de l'application web PyRoute.

+

En savoir plus sur nous

\ No newline at end of file diff --git a/route.py b/route.py index f777b91..6845cf2 100644 --- a/route.py +++ b/route.py @@ -1,4 +1,7 @@ routes = { "/": "page_accueil", - "/a-propos": "a_propos" + "/style.css": "page_accueil_css", + + "/a-propos": "a_propos", + "/aboute.css": "a_propos_css" } \ No newline at end of file diff --git a/serveur.py b/serveur.py index 1732bf9..4a6150e 100644 --- a/serveur.py +++ b/serveur.py @@ -6,6 +6,7 @@ from dotenv import load_dotenv from route import * from controller import * + load_dotenv() listen = int(os.getenv("LISTEN")) host = os.getenv("HOST")