AttributeError: 'NoneType' object has no attribute 'acquire'
I set my tortoise ORM like this
`TORTOISE_ORM_CONFIG =
{
'connections': {
# Using a DB_URL string
'default': 'mysql://root:123456@localhost:3306/SchoolManage'
},
'apps': {
'models': {
'models': ['database.models', "aerich.models"],
# # If no default_connection specified, defaults to 'default'
'default_connection': 'default',
}
}
}`
and I set the orm config in "database.py" module of a package like this ├── config │ ├── init.py │ └── database.py
then I input command aerich init -t config.database.TORTOISE_ORM_CONFIG
it works,the 'pyproject.toml' appears
then I input 'aerich init-db'; it works,the tables appears in db;
then I change the model and execute 'aerich migrate'
the error appears;
here is the traceback infomations;
'Traceback (most recent call last): % aerich migrate
File "/usr/local/bin/aerich", line 11, in
What's the models path?
Hello, I'm getting this exact issue now as well, and I recall this working for me previously. I've just returned to my project after some time and have just returned and rebuilt my project virtualenv. Checking version, It appears Im on the latest (0.6.3). I've tried to set up a new db from scratch and can reproduce the issue. Ive downgraded my version to (0.5.8) and have recreated my database and aerich config from scratch - no issues. @solomn1991 if you can try to downgrade as well, might be worth a shot.
Posting my whole env below, just in case the versions help someone to debug:
aerich==0.5.8 # 0.6.3 was not working
aiodns==3.0.0
aiohttp==3.8.1
aiosignal==1.2.0
aiosqlite==0.17.0
anyio==3.5.0
asgiref==3.5.0
asttokens==2.0.5
async-timeout==4.0.2
asyncpg==0.25.0
attrs==21.4.0
backcall==0.2.0
bcrypt==3.2.0
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.2
cryptography==36.0.2
ddlparse==1.10.0
decorator==5.1.1
dictdiffer==0.9.0
dnspython==2.2.1
email-validator==1.1.3
executing==0.8.3
fastapi==0.75.2
fastapi-users==9.3.1
fastapi-users-db-tortoise==2.0.0
flake8==4.0.1
frozenlist==1.3.0
h11==0.13.0
httptools==0.4.0
idna==3.3
ipdb==0.13.9
ipython==8.2.0
iso8601==0.1.16
jedi==0.18.1
makefun==1.13.1
matplotlib-inline==0.1.3
mccabe==0.6.1
msgpack==1.0.3
multidict==6.0.2
parso==0.8.3
passlib==1.7.4
pexpect==4.8.0
pickleshare==0.7.5
prompt-toolkit==3.0.29
ptyprocess==0.7.0
pure-eval==0.2.2
py-algorand-sdk==1.12.0
pycares==4.1.2
pycodestyle==2.8.0
pycparser==2.21
pycryptodomex==3.14.1
pydantic==1.9.0
pyflakes==2.4.0
Pygments==2.11.2
PyJWT==2.3.0
PyNaCl==1.5.0
pyparsing==3.0.8
pypika-tortoise==0.1.4
python-dotenv==0.20.0
python-multipart==0.0.5
pytz==2022.1
PyYAML==6.0
six==1.16.0
sniffio==1.2.0
stack-data==0.2.0
starlette==0.17.1
toml==0.10.2
tomlkit==0.10.1
tortoise-orm==0.17.8
traitlets==5.1.1
typing_extensions==4.2.0
uvicorn==0.17.6
uvloop==0.16.0
watchgod==0.8.2
wcwidth==0.2.5
websockets==10.3
yarl==1.7.2
backend ├── database │ ├── init.py │ └── models │ ├── Role.py │ ├── User.py │ ├── init.py
this is the structure of model path,R U Chinese?I’m Chinese.
What's the models path?
sorry, I,m not familiar with the page of github.the path is on upstairs
Hello, I'm getting this exact issue now as well, and I recall this working for me previously. I've just returned to my project after some time and have just returned and rebuilt my project virtualenv. Checking version, It appears Im on the latest (0.6.3). I've tried to set up a new db from scratch and can reproduce the issue. Ive downgraded my version to (0.5.8) and have recreated my database and aerich config from scratch - no issues. @solomn1991 if you can try to downgrade as well, might be worth a shot.
Posting my whole env below, just in case the versions help someone to debug:
aerich==0.5.8 # 0.6.3 was not working aiodns==3.0.0 aiohttp==3.8.1 aiosignal==1.2.0 aiosqlite==0.17.0 anyio==3.5.0 asgiref==3.5.0 asttokens==2.0.5 async-timeout==4.0.2 asyncpg==0.25.0 attrs==21.4.0 backcall==0.2.0 bcrypt==3.2.0 cffi==1.15.0 charset-normalizer==2.0.12 click==8.1.2 cryptography==36.0.2 ddlparse==1.10.0 decorator==5.1.1 dictdiffer==0.9.0 dnspython==2.2.1 email-validator==1.1.3 executing==0.8.3 fastapi==0.75.2 fastapi-users==9.3.1 fastapi-users-db-tortoise==2.0.0 flake8==4.0.1 frozenlist==1.3.0 h11==0.13.0 httptools==0.4.0 idna==3.3 ipdb==0.13.9 ipython==8.2.0 iso8601==0.1.16 jedi==0.18.1 makefun==1.13.1 matplotlib-inline==0.1.3 mccabe==0.6.1 msgpack==1.0.3 multidict==6.0.2 parso==0.8.3 passlib==1.7.4 pexpect==4.8.0 pickleshare==0.7.5 prompt-toolkit==3.0.29 ptyprocess==0.7.0 pure-eval==0.2.2 py-algorand-sdk==1.12.0 pycares==4.1.2 pycodestyle==2.8.0 pycparser==2.21 pycryptodomex==3.14.1 pydantic==1.9.0 pyflakes==2.4.0 Pygments==2.11.2 PyJWT==2.3.0 PyNaCl==1.5.0 pyparsing==3.0.8 pypika-tortoise==0.1.4 python-dotenv==0.20.0 python-multipart==0.0.5 pytz==2022.1 PyYAML==6.0 six==1.16.0 sniffio==1.2.0 stack-data==0.2.0 starlette==0.17.1 toml==0.10.2 tomlkit==0.10.1 tortoise-orm==0.17.8 traitlets==5.1.1 typing_extensions==4.2.0 uvicorn==0.17.6 uvloop==0.16.0 watchgod==0.8.2 wcwidth==0.2.5 websockets==10.3 yarl==1.7.2
Thanks a lot ,the problem solved as I follow your hints
I had the same problem. It worked fine after rolled back the version to 0.6.2 and reinitializing the database. tortoise-orm: 0.18.1
The same issue 🤔
https://github.com/tortoise/aerich/pull/242 fix it?
#242 fix it?
Yep, I tested it in many ways 👌
Same issue.