tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
808 stars 91 forks source link

init error No such file 'pyproject.toml' #217

Closed zy7y closed 2 years ago

zy7y commented 2 years ago

version aerich==0.6.0

code

# settings.py
TORTOISE_ORM = {
    "connections": {"default": "mysql://root:123456@localhost:3306/shop"},
    "apps": {
        "models": {
            "models": [ "aerich.models", "models"],
            "default_connection": "default",
        },
    },
}

cmd

aerich init -t settings.TORTOISE_ORM

result

Traceback (most recent call last):
  File "C:\python3.9.8\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\python3.9.8\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "E:\Users\777\PycharmProjects\shop\venv\Scripts\aerich.exe\__main__.py", line 7, in <module>
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\aerich\cli.py", line 255, in main
    cli()
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\aerich\cli.py", line 32, in wrapper
    loop.run_until_complete(f(*args, **kwargs))
  File "C:\python3.9.8\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "e:\users\777\pycharmprojects\shop\venv\lib\site-packages\aerich\cli.py", line 197, in init
    with open(config_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'
Tursunali-Kholdorov commented 2 years ago

@zy7y I was having this issue too. -t, --tortoise-orm option now requires pyproject.toml configuration file in project directory. I just downloaded pyproject.toml file from the aerich repo and placed it in my project directory. And this fixed my issue. I hope this helps you too)

zy7y commented 2 years ago

@zy7y I was having this issue too. -t, --tortoise-orm option now requires pyproject.toml configuration file in project directory. I just downloaded pyproject.toml file from the aerich repo and placed it in my project directory. And this fixed my issue. I hope this helps you too)

thanks

long2ice commented 2 years ago

Current you can touch a empty pyproject.toml if no such file there, I will fix it next release

long2ice commented 2 years ago

Fixed

diegocgaona commented 2 years ago

@long2ice can you update in PyPi please?

wu-clan commented 2 years ago

@long2ice can you update in PyPi please?

I think so, I spent a lot of time on this issue

long2ice commented 2 years ago

released