Comments (14)
是执行哪一步的时候出错了?
from aerich.
是执行哪一步的时候出错了?
就是执行迁移的时候出错了, 迁移的时候产生的路径是migrations\models\old_models这样的, 乌龟没有识别, 他要识别migrations.models.old_models这样的, 上面我提到的修改乌龟的init文件355行可以解决目前的问题,我的乌龟版本是tortoise 0.1.1,
from aerich.
是aerich的版本吧?你升级最新的0.2.0试试
from aerich.
是aerich的版本吧?你升级最新的0.2.0试试
好的, 我目前的是0.1.9, 由于替换了源装不上0.2.0, 我把源改回去试试
from aerich.
从最新的dev分支安装
from aerich.
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.
@mosheduminer Can I see your aerich.ini
?
from aerich.
@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.
Since you use windows,your location maybe .\migrations
from aerich.
@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.
You can give a try.
from aerich.
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.
You are welcome.
from aerich.
@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)
- Aerich doesn't see on_delete parameter change of foreign key
- How to skip certain tables when I migrate database tables
- aerich generates two semicolons in a row HOT 3
- aerich init-db with sqlite3 freezes HOT 4
- aerich upgrade error with \windows_events.py", line 494, in finish_recv return ov.getresult() OSError: [WinError 64] 指定的网络名不再可用。 HOT 3
- 在已有项目添加新的模型后 无法upgrade HOT 3
- side cache
- Initialise an existing project in a new environment HOT 3
- ?sslmode=disable unexpected keyword argument HOT 1
- Can't delete m2m relation HOT 1
- Error running upgrade on Postgres HOT 2
- please support mssql
- Can we simplify the migration file generated by aerich migrate
- Nested database transactions
- varchar max_length change not detected HOT 2
- Improved feedback for "migrate" when models and schema are in sync
- aerich inspectdb makes syntax error
- Pydantic validation error when inspecting DB HOT 4
- AttributeError: 'method_descriptor' object has no attribute '__module__'. Did you mean: '__reduce__'? HOT 1
- stuck on init HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aerich.