From e46f411734136f76bee40f6060147cc2ba11cb1c Mon Sep 17 00:00:00 2001 From: Regela Date: Sat, 27 May 2023 22:26:50 +0300 Subject: [PATCH 1/2] Add requirements --- 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 From 25cd1944e1672b09aec6a88ad0214a0ef26dcbcd Mon Sep 17 00:00:00 2001 From: Regela Date: Sat, 27 May 2023 22:27:00 +0300 Subject: [PATCH 2/2] Reformat --- .gitignore | 1 + demo/__init__.py | 2 +- demo/app.py | 6 +- demo/routes.py | 5 +- demo/templates/index.html | 141 +++++++++++++++++++------------------- demo/views/__init__.py | 2 +- demo/views/frontend.py | 3 +- entry.py | 9 +-- 8 files changed, 83 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index fa2cadf..2fe81d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +venv demo/__pycache__ demo/views/__pycache__ diff --git a/demo/__init__.py b/demo/__init__.py index b23f70e..819ccf0 100644 --- a/demo/__init__.py +++ b/demo/__init__.py @@ -1 +1 @@ -from .app import create_app \ No newline at end of file +from .app import create_app diff --git a/demo/app.py b/demo/app.py index 4fe0516..814e84e 100644 --- a/demo/app.py +++ b/demo/app.py @@ -7,7 +7,7 @@ import aiohttp_jinja2 async def create_app(): app = web.Application() aiohttp_jinja2.setup(app, - loader = jinja2.PackageLoader('demo', 'templates') - ) + loader=jinja2.PackageLoader('demo', 'templates') + ) setup_routes(app) - return app + return app diff --git a/demo/routes.py b/demo/routes.py index f333bef..d76ece0 100644 --- a/demo/routes.py +++ b/demo/routes.py @@ -1,6 +1,7 @@ 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)]) - \ No newline at end of file + app.router.add_routes( + [aiohttp.web.get('/', frontend.index), aiohttp.web.post('/button-clicked', frontend.button_clicked)]) diff --git a/demo/templates/index.html b/demo/templates/index.html index a613686..73473d9 100644 --- a/demo/templates/index.html +++ b/demo/templates/index.html @@ -1,93 +1,96 @@ - - + + Знакомство с aiohttp - - -
-

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

-
+ + +
+

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

+
-
-

+
+ +
+

- -