sanic-org / sanic

Accelerate your web app development | Build fast. Run fast.

Home Page:https://sanic.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Autodiscover` Really good?

JiehuiSun opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

If I use autodiscovery, I would find the routing very messy, yes, that's just my idea. Recursion should not be used.

Describe the solution you'd like

I think we can refer to the structure of django.


  • main.py
    • module1
      • init.py
      • urls.py/routes.py
      • ...

This is my own opinion
My structure

Autodiscovery function config_blueprint

I am a beginner in Python and even more novice in Sanic, but these are my personal opinions

Additional context

No response

This issue has been mentioned on Sanic Community Discussion. There might be relevant details there:

https://community.sanicframework.org/t/test-client-in-production-for-batch-endpoint/1202/5

This is certainly something you can do if you want. It is unlikely to be something in the core project as it is precisely the type of opinionated concept Sanic tries to avoid. There are many ways you can attach handlers as routes. If this works for you I encourage you to pursue it and even make your own extension for it.