GithubHelp home page GithubHelp logo

migrate and upgrade error about aerich HOT 14 OPEN

tortoise avatar tortoise commented on August 26, 2024
migrate and upgrade error

from aerich.

Comments (14)

long2ice avatar long2ice commented on August 26, 2024

是执行哪一步的时候出错了?

from aerich.

mylot-python avatar mylot-python commented on August 26, 2024

是执行哪一步的时候出错了?

就是执行迁移的时候出错了, 迁移的时候产生的路径是migrations\models\old_models这样的, 乌龟没有识别, 他要识别migrations.models.old_models这样的, 上面我提到的修改乌龟的init文件355行可以解决目前的问题,我的乌龟版本是tortoise 0.1.1,

from aerich.

long2ice avatar long2ice commented on August 26, 2024

是aerich的版本吧?你升级最新的0.2.0试试

from aerich.

mylot-python avatar mylot-python commented on August 26, 2024

是aerich的版本吧?你升级最新的0.2.0试试

好的, 我目前的是0.1.9, 由于替换了源装不上0.2.0, 我把源改回去试试

from aerich.

long2ice avatar long2ice commented on August 26, 2024

从最新的dev分支安装

from aerich.

mosheduminer avatar mosheduminer commented on August 26, 2024

I cannot upgrade with either aerich 0.2.0 nor the latest dev branch. With 0.2.0 the error is

ModuleNotFoundError: No module named 'migrations\\models\\old_models'

On the latest dev, the error is

ModuleNotFoundError: No module named '/migrations'

Can you please help/advise?

I'm using windows 10, python 3.8.

from aerich.

long2ice avatar long2ice commented on August 26, 2024

@mosheduminer Can I see your aerich.ini?

from aerich.

mosheduminer avatar mosheduminer commented on August 26, 2024

@long2ice my aerich.ini file is as follows:

[aerich]
tortoise_orm = app.settings.TORTOISE_ORM
location = ./migrations


Sorry I can't point you towards a repo, the code is private.

from aerich.

long2ice avatar long2ice commented on August 26, 2024

Since you use windows,your location maybe .\migrations

from aerich.

mosheduminer avatar mosheduminer commented on August 26, 2024

@long2ice that fixed it! Thanks! Only now I have another issue, my models are defined in multiple files, with relative imports between them. Would it be correct to say that aerich cannot handle relative imports?

from aerich.

long2ice avatar long2ice commented on August 26, 2024

You can give a try.

from aerich.

mosheduminer avatar mosheduminer commented on August 26, 2024

Ah, I was asking because I get the following error:

ModuleNotFoundError: No module named 'migrations.models.user'

Which appears to happen due to a relative import...

It seems that all the models are put in a single old_models file, without the imports being removed. For example, this is taken from the __init__.py file:

from .user import User
from .building import Building
from .apartment import Apartment
from .package import Package

with further imports between files. I changed the imports to be absolute, and everything works now. Thanks you so much for your help!

from aerich.

long2ice avatar long2ice commented on August 26, 2024

You are welcome.

from aerich.

zhangyuxin123 avatar zhangyuxin123 commented on August 26, 2024

@long2ice Hello, regarding Module "\migrations\models\old_models" not found, I used your method above and still failed to solve my problem. Is there any other way to deal with it?
The following is the directory structure of my test project
https://note.youdao.com/yws/api/personal/file/WEB10281d2a965db99ebbef67a0fe7874d2?method=download&shareKey=3ffe95da605e5e5ae8b22f2a1986a163

from aerich.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.