diff --git a/__pycache__/controller.cpython-311.pyc b/__pycache__/controller.cpython-311.pyc index 6c9d6b7..0f22dc8 100644 Binary files a/__pycache__/controller.cpython-311.pyc and b/__pycache__/controller.cpython-311.pyc differ diff --git a/__pycache__/modules.cpython-311.pyc b/__pycache__/modules.cpython-311.pyc index df92511..85b0db5 100644 Binary files a/__pycache__/modules.cpython-311.pyc and b/__pycache__/modules.cpython-311.pyc differ diff --git a/__pycache__/route.cpython-311.pyc b/__pycache__/route.cpython-311.pyc index e63ab29..4594e41 100644 Binary files a/__pycache__/route.cpython-311.pyc and b/__pycache__/route.cpython-311.pyc differ 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")