45 lines
962 B
Python
45 lines
962 B
Python
from izzylib import logging
|
|
from izzylib.http_server import Application, Request
|
|
|
|
from . import __version__, views
|
|
from .config import config, path
|
|
from .database import db
|
|
from .middleware import AuthCheck
|
|
|
|
|
|
def template_context(context):
|
|
with db.session as s:
|
|
config = s.get.config_all()
|
|
|
|
try:
|
|
context['config'] = config
|
|
except:
|
|
context['config'] = {}
|
|
|
|
return context
|
|
|
|
|
|
def HttpRequest(Request):
|
|
pass
|
|
|
|
|
|
with db.session as s:
|
|
app = Application(
|
|
name = s.get.config('name'),
|
|
version = __version__,
|
|
listen = config.listen,
|
|
port = config.port,
|
|
host = config.host,
|
|
workers = config.workers,
|
|
git_repo = 'https://git.barkshark.xyz/izaliamae/uncia',
|
|
proto = 'https',
|
|
#request_class = HttpRequest,
|
|
tpl_search = [path.frontend],
|
|
tpl_context = template_context,
|
|
class_views = [getattr(views, view) for view in dir(views) if view.startswith('Uncia')]
|
|
)
|
|
|
|
app.add_middleware(AuthCheck)
|
|
app.static('/style', path.frontend.join('style'))
|
|
|