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
|
.. license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .app import Application
|
from .app import Application, app
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .context import Variable, get_backend, get_bus, get_plugin
|
from .context import Variable, get_backend, get_bus, get_plugin
|
||||||
from .cron import cron
|
from .cron import cron
|
||||||
|
@ -31,6 +31,7 @@ __all__ = [
|
||||||
'Event',
|
'Event',
|
||||||
'Request',
|
'Request',
|
||||||
'Response',
|
'Response',
|
||||||
|
'app',
|
||||||
'cron',
|
'cron',
|
||||||
'get_backend',
|
'get_backend',
|
||||||
'get_bus',
|
'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()
|
self._run()
|
||||||
|
|
||||||
|
|
||||||
|
app: Optional[Application] = None
|
||||||
|
|
||||||
|
|
||||||
def main(*args: str):
|
def main(*args: str):
|
||||||
"""
|
"""
|
||||||
Application entry point.
|
Application entry point.
|
||||||
"""
|
"""
|
||||||
|
global app
|
||||||
|
|
||||||
app = Application.from_cmdline(args)
|
app = Application.from_cmdline(args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue