# -*- coding: utf-8 -*- from datetime import datetime from plant import Node from flask import request from p4rr0t007.web import Application here = Node(__file__).dir server = Application(here, static_path='/dist', template_folder=here.path, static_folder=here.join('dist')) @server.route('/') def index(): return server.template_response("index.html", { 'user_token': request.cookies.get('bellyfeel_token') or '' }) @server.route('/api/login') def projects(): return server.json_response([ { "name": "Foo", "description": "The foo of the bar", "tags": ["test", "local"], "url": "http://foo.co", "last_build": datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S"), }, { "name": "Bar", "description": "The bar whence the foo belongs", "tags": ["example", "local"],
#!/usr/bin/env python # -*- coding: utf-8 -*- # # flake8: noqa import os import logging from plant import Node from carpentry import routes from carpentry.server import CarpentryHttpServer log_path = os.getenv('CARPENTRY_LOG_PATH', '/var/log/carpentry.log') logging.basicConfig( filename=log_path, level=logging.INFO, ) root_node = Node(__file__).dir application = CarpentryHttpServer( log_level=logging.INFO, template_folder=root_node.join('templates'), static_folder=root_node.join('static'), static_url_path='/static', use_sqlalchemy=False )