remove annoying warnings and unnecessary prints.

show a summary of some settings on startup when running __main__.py
This commit is contained in:
fiatjaf 2020-10-06 12:59:06 -03:00
parent c5352c0309
commit 9a16dfa960
4 changed files with 20 additions and 9 deletions

View file

@ -1,9 +1,21 @@
from .app import create_app
from .commands import migrate_databases, transpile_scss, bundle_vendored
from .settings import LNBITS_SITE_TITLE, SERVICE_FEE, DEBUG, LNBITS_DATA_FOLDER, WALLET
migrate_databases()
transpile_scss()
bundle_vendored()
app = create_app()
print(
f"""Starting LNbits with
- site title: {LNBITS_SITE_TITLE}
- debug: {DEBUG}
- data folder: {LNBITS_DATA_FOLDER}
- funding source: {WALLET.__class__.__name__}
- service fee: {SERVICE_FEE}
"""
)
app.run(host=app.config["HOST"], port=app.config["PORT"])

View file

@ -1,4 +1,3 @@
import trio # type: ignore
import importlib
from quart import g
@ -112,9 +111,7 @@ def register_async_tasks(app):
@app.before_serving
async def listeners():
run_deferred_async(app.nursery)
app.nursery.start_soon(invoice_listener)
print("started global invoice_listener.")
@app.after_serving
async def stop_listeners():

View file

@ -1,11 +1,10 @@
import warnings
import click
import importlib
import re
import os
import sqlite3
from scss.compiler import compile_string # type: ignore
from .core import migrations as core_migrations
from .db import open_db, open_ext_db
from .helpers import get_valid_extensions, get_css_vendored, get_js_vendored, url_for_vendored
@ -24,9 +23,13 @@ def handle_assets():
def transpile_scss():
with open(os.path.join(LNBITS_PATH, "static/scss/base.scss")) as scss:
with open(os.path.join(LNBITS_PATH, "static/css/base.css"), "w") as css:
css.write(compile_string(scss.read()))
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from scss.compiler import compile_string # type: ignore
with open(os.path.join(LNBITS_PATH, "static/scss/base.scss")) as scss:
with open(os.path.join(LNBITS_PATH, "static/css/base.css"), "w") as css:
css.write(compile_string(scss.read()))
def bundle_vendored():

View file

@ -67,7 +67,6 @@ def register_invoice_listener(send_chan: trio.MemorySendChannel):
A method intended for extensions to call when they want to be notified about
new invoice payments incoming.
"""
print(f"registering invoice_listener: {send_chan}")
invoice_listeners.append(send_chan)