if [ ! -d '.git' ]; then
echo "Cannot find .git/, please run me from your cloned repo's top directory!"
-elif [ ! -f '.git/hooks/pre-commit' ]; then
+fi
+
+pip install -r requirements.txt
+
+if [ ! -f '.git/hooks/pre-commit' ]; then
echo 'Linking pre-commit hook.'
cd .git/hooks/
ln -s ../../scripts/pre-commit
"""
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
+from jinja2 import Environment as JinjaEnv, FileSystemLoader as JinjaFSLoader
HTTP_PORT = 8082
+TEMPLATES_DIR = 'templates'
class HandledException(Exception):
"""Handle any GET request."""
self.send_response(200)
self.end_headers()
- html = '<html><body><p>hi there!</p></body></html>'
+ html = self.server.jinja.get_template('index.html').render()
self.wfile.write(bytes(html, 'utf-8'))
def main():
"""Main loop."""
server = HTTPServer(('localhost', HTTP_PORT), TaskHandler)
+ server.jinja = JinjaEnv(loader=JinjaFSLoader(TEMPLATES_DIR))
print(f'running at port {HTTP_PORT}')
try:
server.serve_forever()