App

Getting App Instance

The SuperdeskAsyncApp app is built for us automatically in the SuperdeskEve app. You can retrieve an instance of this app from the get_current_async_app method.:

from superdesk.core.app import get_current_async_app

def test():
    get_current_async_app().get_module_list()

APP References

get_current_async_app() SuperdeskAsyncApp[source]

Retrieve the current app instance

class SuperdeskAsyncApp(wsgi: WSGIApp)[source]
wsgi: WSGIApp

A class instance that adheres to the WSGI protocol

mongo: MongoResources

MongoResources instance used to manage mongo config, clients and resources

elastic: ElasticResources

ElasticResources instance used to manage elastic config, clients and resources

property running: bool

Returns True if the app is running

get_module_list() List[Module]

Returns the list of loaded modules, in descending order based on their priority

start()

Start the app

This loads all the modules, based on the MODULES config

Raises:
  • RuntimeError – if the app is already running

  • RuntimeError – if any module failed to load

stop()

Stops the app

This tells MongoResources to stop, clears imported modules and sets running to False