copanier/copanier/__init__.py
Alexis Metaireau 2b0459e94a
Specify the version in copanier/__init__.py. (#129)
And use it when loading the css files in order to not have the css files
cached by the browsers after an update.

Fix #124
2022-10-25 23:56:26 +02:00

42 lines
977 B
Python

from pathlib import Path
import minicli
from roll.extensions import simple_server, static
from .models import Product, Person, Order, Delivery
from .views.core import app
__version__ = "0.0.5"
@minicli.cli()
def shell():
"""Run an ipython in app context."""
try:
from IPython import start_ipython
except ImportError:
print('IPython is not installed. Type "pip install ipython"')
else:
start_ipython(
argv=[],
user_ns={
"app": app,
"Product": Product,
"Person": Person,
"Order": Order,
"Delivery": Delivery,
},
)
@minicli.cli
def serve(reload=False):
"""Run a web server (for development only)."""
if reload:
import hupper
hupper.start_reloader("copanier.serve")
static(app, root=Path(__file__).parent / "static")
simple_server(app, port=2244)
def main():
minicli.run()