app_module_for_backend.py 453 B

12345678910111213
  1. """Shims the real reflex app module for running backend server (uvicorn or gunicorn).
  2. Only the app attribute is explicitly exposed.
  3. """
  4. from reflex import constants
  5. from reflex.utils.prerequisites import get_compiled_app
  6. if "app" != constants.CompileVars.APP:
  7. raise AssertionError("unexpected variable name for 'app'")
  8. app = getattr(get_compiled_app(), constants.CompileVars.APP)
  9. # ensure only "app" is exposed.
  10. del get_compiled_app
  11. del constants