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

Compatibility for apps with CLI #123

Closed
Olegt0rr opened this issue Mar 10, 2021 · 6 comments · May be fixed by #127 or #128
Closed

Compatibility for apps with CLI #123

Olegt0rr opened this issue Mar 10, 2021 · 6 comments · May be fixed by #127 or #128

Comments

@Olegt0rr
Copy link

Olegt0rr commented Mar 10, 2021

To read POSTGRES_URI my app uses CLI with -c flag (to provide config path)
How can I set up aerich to prevent CLI conflicts?

Version

aerich==0.5.0
As described, I've dropped all database, removed migrations folder.

Run command

aerich init-db

Result

usage: aerich [-h] [-c C]
aerich: error: unrecognized arguments: init-db

Config

aerich.ini

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

app.config.TORTOISE_ORM

TORTOISE_ORM = {
    "connections": {"default":POSTGRES_URI},
    "apps": {
        "models": {
            "models": ["app.models", "aerich.models"],
            "default_connection": "default",
        },
    },
}
@long2ice
Copy link
Member

So strange

@Olegt0rr
Copy link
Author

Olegt0rr commented Mar 11, 2021

So strange

It was affected by my app.
app.config imports cli to handle custom cfg -c config.yml for my app.
So cli and aerich conflicts with each other.

It would be great if you know how to isolate aerich from app's cli

@Olegt0rr Olegt0rr changed the title unrecognized arguments: init-db Compatibility for apps with CLI Mar 12, 2021
@Olegt0rr
Copy link
Author

@long2ice is there any way to pass args for app module through aerich?
In my case: provide config path for app via -c

@long2ice
Copy link
Member

long2ice commented Mar 12, 2021

Sorry I don't know what do you mean

@Olegt0rr
Copy link
Author

To run my app I use

python -m my_app -c config.yml

So, my app always waits for -c config.yml

When aerich trying to work with my app, it didn't pass -c config.yml, so my app can't get my config.

@long2ice
Copy link
Member

What about split config file from you app?

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