'Can I specify the parent folder name instead of individual modules in the Tortoise ORM config_file?

I am using the a json config_file with the Tortoise ORM setup.

This is a sample entry from the working file:

"apps": {
   "my_app": {
      "models": ["my_models.users", "my_models.teams"],
      "default_connection": "default",
   }
},

my_models is the folder and users.py and teams.py are its files.

I would like to only have the parent folder my_models specified in the config file, and not need to enumerate all the sub modules under that directory (my_models.users, my_models.teams etc.)

On larger projects this could look pretty ugly, difficult to maintain.

The question is: "Is there a way to specify only the folder name instead?"

For example with a wild card, making the configuration element look something like:

"apps": {
   "my_app": {
      "models": ["my_models.*"],
      "default_connection": "default",
   }
},


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source