tortoise / tortoise/tortoise-orm
About multi-databases and multi-apps configuration
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
TORTOISE_ORM = {
"connections": {"default": MYSQL_URL,"admin": ADMIN_MYSQL_URL},
"apps": {
"app1": {
"models": [...],
"default_connection": MYSQL_URL,
},
"app2": {
"models": [...],
"default_connection": ADMIN_MYSQL_URL,
},
},
}
in method - get_related_model(related_app_name, related_model_name) of tortoise/init.py ,related_app_name can only get 'models',can't get app_label 'app1' or app_label 'app2',so it report error! For making it run correctly I changed 'related_app_name' to 'app_name'. Sorry,I don't know if my Chinglish is clear.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tortoise/init.py at get_related_model(related_app_name, related_model_name) and trace how app labels are resolved for the shown multi-database configuration. Reproduce the relation lookup with app1 and app2, then verify that related models resolve under their configured app labels without breaking existing single-app behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100