From c3ab24044f62e4ed9b11c1cf2b7427ee4ca50770 Mon Sep 17 00:00:00 2001 From: kirill Date: Sun, 28 May 2023 22:31:00 +0300 Subject: [PATCH 1/3] add input field --- demo/templates/index.html | 116 +++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 63 deletions(-) diff --git a/demo/templates/index.html b/demo/templates/index.html index a613686..af8e585 100644 --- a/demo/templates/index.html +++ b/demo/templates/index.html @@ -12,86 +12,76 @@ min-height: 100vh; background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%) } - - h1 { - text-align: center; + h1{ color: white; - text-shadow: 0 2px 5px rgba(150, 150, 150, 0.8); + } - - #root { - display: flex; - flex-direction: column; - align-items: center; + p{ + color:white; } - - - .form { - width: 70%; - margin-bottom: 20px; + .container{ + margin-left: 20vw; } - - .form__button { - text-align: center; - margin-top: 10px; - background-color: white; - cursor: pointer; + #submit{ + margin-top: 20px; + border-radius: 10px; + height: 50px; + width:50vw; + color:black; } - - #myButton { - box-sizing: border-box; - width: 100%; - font-size: 18px; - outline: none; - border: none; - padding: 20px; - border-radius: 5px; - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - -webkit-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1); - box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1); + #inputText{ + border-radius: 10px; + height: 30px; + width: 49.5vw; } - - #myButton:hover { - -webkit-transition: 0.3s; - -moz-transition: 0.3s; - transition: 0.3s; - -webkit-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5); - box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5); - } - #myResult { + .container_result{ + margin-top: 20px; + min-height: 50px; text-align: center; - color: white; - text-shadow: 0 2px 5px rgba(150, 150, 150, 0.8); + width: 50vw; + border: 3px solid white; + border-radius: 5px; + background-color: grey; } + + - -
+

Знакомство с aiohttp

-
-

+
+ +
+ +
+
+

+
+
- + -- 2.31.1 From e1a15fa389523a273ebc201b6e17d5848c155682 Mon Sep 17 00:00:00 2001 From: kirill Date: Sun, 28 May 2023 22:32:16 +0300 Subject: [PATCH 2/3] add response text and print text terminal --- demo/routes.py | 2 +- demo/views/frontend.py | 6 +++++- entry.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/demo/routes.py b/demo/routes.py index f333bef..db9a4a5 100644 --- a/demo/routes.py +++ b/demo/routes.py @@ -2,5 +2,5 @@ from .views import frontend import aiohttp def setup_routes(app): - app.router.add_routes([aiohttp.web.get('/', frontend.index), aiohttp.web.post('/button-clicked', frontend.button_clicked)]) + app.router.add_routes([aiohttp.web.get('/', frontend.index), aiohttp.web.post('/submit', frontend.button_clicked)]) \ No newline at end of file diff --git a/demo/views/frontend.py b/demo/views/frontend.py index 25525d2..ef6e0e2 100644 --- a/demo/views/frontend.py +++ b/demo/views/frontend.py @@ -10,4 +10,8 @@ async def index(request): async def button_clicked(request): - return aiohttp.web.json_response({'result':'Button was clicked'}) \ No newline at end of file + data = await request.post() + text = data.get('text') + response_text = f'Вы ввели: {text}' + print(response_text) + return aiohttp.web.Response(text=response_text) \ No newline at end of file diff --git a/entry.py b/entry.py index de968e0..e472c3b 100644 --- a/entry.py +++ b/entry.py @@ -11,4 +11,4 @@ app = create_app() if __name__ == '__main__': - aiohttp.web.run_app(app) \ No newline at end of file + aiohttp.web.run_app(app) \ No newline at end of file -- 2.31.1 From bf73203892e2545f81d7c6a5d62739499513cfb2 Mon Sep 17 00:00:00 2001 From: kirill Date: Sun, 28 May 2023 23:03:11 +0300 Subject: [PATCH 3/3] add requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..dfb4018 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +aiohttp~=3.8.4 +Jinja2~=3.1.2 \ No newline at end of file -- 2.31.1