commit f709f78bcfb71f5a11bff8e255e9683dbb05bb54 Author: iou1name Date: Sat Sep 14 18:36:23 2019 -0400 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..610faed --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +*.swp +*.swo +config.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..6938d97 --- /dev/null +++ b/README.md @@ -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` diff --git a/buckler.py b/buckler.py new file mode 100644 index 0000000..451aa2c --- /dev/null +++ b/buckler.py @@ -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) diff --git a/config.py.template b/config.py.template new file mode 100644 index 0000000..d9524ed --- /dev/null +++ b/config.py.template @@ -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' diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..2a4f6b0 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,10 @@ + + + + Buckler + + +

Buckler

+ Secret page. + + diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..2a25b78 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,17 @@ + + + + Buckler - Login + + +

Buckler Login

+
+ + + + + +
+ + +