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 db9a4a5..3940b96 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('/submit', frontend.button_clicked)]) \ No newline at end of file diff --git a/demo/templates/index.html b/demo/templates/index.html index af8e585..b0613b1 100644 --- a/demo/templates/index.html +++ b/demo/templates/index.html @@ -14,7 +14,7 @@ } h1{ color: white; - + } p{ color:white; @@ -44,7 +44,7 @@ background-color: grey; } - + diff --git a/demo/views/__init__.py b/demo/views/__init__.py index 76c69e8..20f280e 100644 --- a/demo/views/__init__.py +++ b/demo/views/__init__.py @@ -1 +1 @@ -from . import frontend \ No newline at end of file +from . import frontend diff --git a/demo/views/frontend.py b/demo/views/frontend.py index ef6e0e2..b5f5ecf 100644 --- a/demo/views/frontend.py +++ b/demo/views/frontend.py @@ -3,7 +3,6 @@ import aiohttp from aiohttp_jinja2 import template - @template('index.html') async def index(request): return {} diff --git a/entry.py b/entry.py index e472c3b..cb4d3e3 100644 --- a/entry.py +++ b/entry.py @@ -1,14 +1,8 @@ import aiohttp from demo import create_app - - - - app = create_app() - - - if __name__ == '__main__': - aiohttp.web.run_app(app) \ No newline at end of file + aiohttp.web.run_app(app) +