Added the current running application as a static object.

```python
from platypush import app
```
This commit is contained in:
Fabio Manganiello 2024-05-20 01:54:25 +02:00
parent 32b8296244
commit 86b4b14112
Signed by: blacklight
GPG key ID: D90FBA7F76362774
3 changed files with 9 additions and 3 deletions

View file

@ -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',

View file

@ -1,4 +1,4 @@
from ._app import Application, main
from ._app import Application, app, main
__all__ = ["Application", "main"]
__all__ = ["Application", "app", "main"]

View file

@ -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: