How to use the py4web.core.Reloader.import_apps function in py4web

To help you get started, we’ve selected a few py4web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web2py / py4web / py4web / core.py View on Github external
def wsgi(**args):
    """Initializes everything, loads apps, returns the wsgi app"""
    initialize(**args)
    Reloader.import_apps()
    return bottle.default_app()
github web2py / py4web / apps / _dashboard / __init__.py View on Github external
def reload(name=None):
        """Reloads installed apps"""
        Reloader.import_app(name) if name else Reloader.import_apps()
        return "ok"
github web2py / py4web / py4web / core.py View on Github external
print("")  # Insert a blank line to improve readability
    # If we know where the password is stored, read it, otherwise ask for one
    if args.dashboard_mode not in ("demo", "none") and not os.path.exists(
        args.password_file
    ):
        password = getpass.getpass("Choose a one-time dashboard password: ")
        print('Storing the hashed password in file "%s"' % args.password_file)
        with open(args.password_file, "w") as fp:
            fp.write(str(pydal.validators.CRYPT()(password)[0]))
    # Store all args in environment variables to make them available to the following processes
    # and create any missing folders
    initialize(**args.__dict__)
    if os.path.exists(os.path.join(args.apps_folder, "_dashboard")):
        print("Dashboard is at: http://%s:%s/_dashboard" % (args.host, args.port))
    # start
    Reloader.import_apps()
    start_server(args)