sanic icon indicating copy to clipboard operation
sanic copied to clipboard

dynamic update blueprint

Open amoxuk opened this issue 6 months ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

some package in my folder, I want add new package in the folder at sanic running.

@app.get('xx') async def reload(rq): for folder in os.listdir('somefolder'): pkg = importlib.import_module(folder) _lib.append(pkg.app) bp = Bleprint.group(*_lib,url_prefix='/someurl') app.router.reset() app.blueprint(bp)

reload success but use the url throw error. Nonetype object is not callable in sanic router

Code snippet

No response

Expected Behavior

No response

How do you run Sanic?

As a script (app.run or Sanic.serve)

Operating System

Linux

Sanic Version

22.12.0

Additional context

No response

amoxuk avatar Jul 26 '24 05:07 amoxuk