Make own url configureable

This commit is contained in:
Jan Losinski 2019-01-21 18:39:09 +01:00
parent 9cdb9877bc
commit 0ae893a83c
3 changed files with 5 additions and 3 deletions

View File

@ -53,7 +53,7 @@ def main(host, port, db, interval, debug, tz, special,
wrk = worker.Worker(loop, db_mngr, tm=tm, mail=mail, debug=debug)
loop.create_task(wrk.run())
app = interface.App(db_mngr)
app = interface.App(db_mngr, base_url=url)
loop.create_task(app.register_server(host, port))
loop.run_forever()

View File

@ -230,8 +230,9 @@ def simple_view(template):
class App(object):
def __init__(self, database_manager: model.DatabaseManager):
def __init__(self, database_manager: model.DatabaseManager, base_url: str):
self.db = database_manager
self.base_url = base_url
self.app = web.Application()
self.setup_app()
@ -243,6 +244,7 @@ class App(object):
self.app, loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))
self.app['static_root_url'] = '/static'
self.app['cfg_base_url'] = self.base_url
def setup_routes(self):
self.app.router.add_static('/static/',

View File

@ -25,7 +25,7 @@
<h4>INSTRUCTIONS:</h4>
<p>Keep Punkow (<a href="https://punkow.jonesinski.de">punkow.jonesinski.de</a>) open and open a new window of your
<p>Keep Punkow (<a href="{{ app.cfg_base_url }}">{{ app.cfg_base_url }}</a>) open and open a new window of your
internet browser.</p>
<p>Select the service you want to book at: