tortoise / tortoise/tortoise-orm

Add a modules folder name instead of file names into config_file

Open
#975 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

I am using the json config_file approach for Tortoise ORM setup.

This is a part of 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 put just the my_models folder name into the config file and not to have to put my_models.users, my_models.teams etc.

This could be the desired result:

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the JSON config_file loads and resolves the models list; the issue does not name a source file or test. Check how dotted module names are currently handled, then add coverage showing that a folder pattern such as my_models.* discovers its modules and that the configured models still initialize correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.