Compare commits

..

No commits in common. '738008fd6aa3275ee3cd637a089863cd436a3c5b' and 'bf73203892e2545f81d7c6a5d62739499513cfb2' have entirely different histories.

  1. 1
      .gitignore
  2. 2
      demo/__init__.py
  3. 6
      demo/app.py
  4. 1
      demo/routes.py
  5. 4
      demo/templates/index.html
  6. 2
      demo/views/__init__.py
  7. 1
      demo/views/frontend.py
  8. 10
      entry.py

1
.gitignore vendored

@ -1,3 +1,2 @@
venv
demo/__pycache__ demo/__pycache__
demo/views/__pycache__ demo/views/__pycache__

@ -1 +1 @@
from .app import create_app from .app import create_app

@ -7,7 +7,7 @@ import aiohttp_jinja2
async def create_app(): async def create_app():
app = web.Application() app = web.Application()
aiohttp_jinja2.setup(app, aiohttp_jinja2.setup(app,
loader=jinja2.PackageLoader('demo', 'templates') loader = jinja2.PackageLoader('demo', 'templates')
) )
setup_routes(app) setup_routes(app)
return app return app

@ -1,7 +1,6 @@
from .views import frontend from .views import frontend
import aiohttp import aiohttp
def setup_routes(app): def setup_routes(app):
app.router.add_routes([aiohttp.web.get('/', frontend.index), aiohttp.web.post('/submit', frontend.button_clicked)]) app.router.add_routes([aiohttp.web.get('/', frontend.index), aiohttp.web.post('/submit', frontend.button_clicked)])

@ -14,7 +14,7 @@
} }
h1{ h1{
color: white; color: white;
} }
p{ p{
color:white; color:white;
@ -44,7 +44,7 @@
background-color: grey; background-color: grey;
} }
</style> </style>
</head> </head>
<body> <body>

@ -1 +1 @@
from . import frontend from . import frontend

@ -3,6 +3,7 @@ import aiohttp
from aiohttp_jinja2 import template from aiohttp_jinja2 import template
@template('index.html') @template('index.html')
async def index(request): async def index(request):
return {} return {}

@ -1,8 +1,14 @@
import aiohttp import aiohttp
from demo import create_app from demo import create_app
app = create_app() app = create_app()
if __name__ == '__main__':
aiohttp.web.run_app(app)
if __name__ == '__main__':
aiohttp.web.run_app(app)
Loading…
Cancel
Save