forked from platypush/platypush
Added the current running application as a static object.
```python from platypush import app ```
This commit is contained in:
parent
32b8296244
commit
86b4b14112
3 changed files with 9 additions and 3 deletions
|
@ -5,7 +5,7 @@ Platypush
|
|||
.. license: MIT
|
||||
"""
|
||||
|
||||
from .app import Application
|
||||
from .app import Application, app
|
||||
from .config import Config
|
||||
from .context import Variable, get_backend, get_bus, get_plugin
|
||||
from .cron import cron
|
||||
|
@ -31,6 +31,7 @@ __all__ = [
|
|||
'Event',
|
||||
'Request',
|
||||
'Response',
|
||||
'app',
|
||||
'cron',
|
||||
'get_backend',
|
||||
'get_bus',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from ._app import Application, main
|
||||
from ._app import Application, app, main
|
||||
|
||||
|
||||
__all__ = ["Application", "main"]
|
||||
__all__ = ["Application", "app", "main"]
|
||||
|
|
|
@ -464,10 +464,15 @@ class Application:
|
|||
self._run()
|
||||
|
||||
|
||||
app: Optional[Application] = None
|
||||
|
||||
|
||||
def main(*args: str):
|
||||
"""
|
||||
Application entry point.
|
||||
"""
|
||||
global app
|
||||
|
||||
app = Application.from_cmdline(args)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue