You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a service on FastAPI using Tortoise-ORM.
The problem is that in this case it is not possible to find the models under the module.
I always get this warning from Tortoise ./flexipay/lib/python3.8/site-packages/tortoise/__init__.py:514: RuntimeWarning: Module "apps.res_users.models" has no models
I am unable to create the correct migration and have no previous migration history.
What is your demand? If you want to apply your changes to the database, why not use aerich cli? I have a project structure imilar to yours. My aerich version is 0.7.2.
fromtortoiseimportfields, modelsclassBaseModel(models.Model):
""" The `base_model` model """update_time=fields.DatetimeField(auto_now=True)
create_time=fields.DatetimeField(auto_now_add=True)
classMeta:
abstract=TrueclassOtherModels(models.Model):
....
Then I execute aerich command in the settings.py sibling directory to generate migrations folder and migrate & upgrade changed files to specify version, every thing is ok. Official Usage
After that and I have some new files in migrations/models folder now:
migrations
└── models
├── 1_20240805215208_add_global_id.py
└── 0_20240805203911_init.py
Summary: Total folders: 1 Total files: 2 Total size: 4.8KiB
HI.
I am building a service on FastAPI using Tortoise-ORM.
The problem is that in this case it is not possible to find the models under the module.
I always get this warning from Tortoise
./flexipay/lib/python3.8/site-packages/tortoise/__init__.py:514: RuntimeWarning: Module "apps.res_users.models" has no models
I am unable to create the correct migration and have no previous migration history.
config:
init_db.py
It only creates the "aerich" table.
The text was updated successfully, but these errors were encountered: