initial commit

This commit is contained in:
iou1name 2019-09-14 18:36:23 -04:00
commit f709f78bcf
6 changed files with 77 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
__pycache__/
*.swp
*.swo
config.py

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Buckler
A security shield for protecting a number of small web applications.
## Requirements
Python 3.7+
PostgreSQL 11.5+
Python packages: `gunicorn aiohttp aiohttp_jinja2 psycopg2 passlib argon2_cffi`
## Install
1. Get on the floor
2. Walk the dinosaur
## Usage
`gunicorn buckler:app --bind localhost:5400 --worker-class aiohttp.GunicornWebWorker`

25
buckler.py Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""
A security shield for protecting a number of small web applications.
"""
from aiohttp import web
import jinja2
import aiohttp_jinja2
from aiohttp_jinja2 import render_template
import config
app = web.Application()
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('templates'))
routes = web.RouteTableDef()
@routes.get(config.url_prefix + "/", name='index')
async def index(request):
"""The index page."""
return render_template("index.html", request, locals())
app.router.add_routes(routes)
if __name__ == "__main__":
web.run_app(app, host='0.0.0.0', port=5400)

7
config.py.template Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
"""
Configuration settings for Buckler.
url_prefix` is the root path you wish app to reside at
eg. https://example.com/buckler
"""
url_prefix = '/buckler'

10
templates/index.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Buckler</title>
</head>
<body>
<h1>Buckler</h1>
Secret page.
</body>
</html>

17
templates/login.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Buckler - Login</title>
</head>
<body>
<h1>Buckler Login</h1>
<form action="/login" method="post" enctype="application/x-www-form-urlencoded">
<label for="username">Username</label>
<input id="username" name="password" type="text">
<label for="password">Password</label>
<input id="password" name="password" type="password">
<input type="submit" value="Login">
</form>
</body>
</html>