Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用dev代码 #29

Open
fangaofeng opened this issue Jul 22, 2020 · 6 comments
Open

使用dev代码 #29

fangaofeng opened this issue Jul 22, 2020 · 6 comments

Comments

@fangaofeng
Copy link

(env) PS E:\fastapitest> aerich migrate
Traceback (most recent call last):
File "e:\fastapitest\env\lib\site-packages\tortoise_init_.py", line 353, in discover_models
module = importlib.import_module(models_path)
File "C:\Python\Python38\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File ".\migrations\models\old_models.py", line 13, in
from .base import AbstractBaseModel
ModuleNotFoundError: No module named 'migrations.models.base'

使用了如下代码

from tortoise.contrib.pydantic import pydantic_model_creator
from .base import AbstractBaseModel

在migrations中没有copy base这个模块。

@long2ice
Copy link
Member

把相对路径改绝对路径吧

@fangaofeng
Copy link
Author

我试试,django的migration如果修改乌龟使用可能吗?复杂不复杂

@long2ice
Copy link
Member

不通用

@maxim-s-barabash
Copy link

The documentation should describe that the model is merged into one file old_model.py.
Relative imports are not allowed, Absolute imports are undesirable.

@SweetMcdull
Copy link

要改成绝对路径导入才行,这个是否有计划修复呢?

@long2ice
Copy link
Member

暂时还没有,主要我用的时候一般是绝对路径

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants