Cannot Migrate Database with psql._local_config.py after calling aerich init -t api_server.__main__.TORTOISE_ORM --location /tmp/migrations in terminal
gurgenufuk12 opened this issue · 2 comments
Before proceeding, is there an existing issue or discussion for this?
- I have done a search for similar issues and discussions.
Description
Cannot Migrate Database with psql._local_config.py after calling aerich init -t api_server.main.TORTOISE_ORM --location /tmp/migrations as defined as in the README.md file in the api.server. Getting an error like down below,
**File "/usr/local/bin/aerich", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/aerich/cli.py", line 265, in main
cli()
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/aerich/cli.py", line 31, in wrapper
loop.run_until_complete(f(*args, kwargs))
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/aerich/cli.py", line 201, in init
get_tortoise_config(ctx, tortoise_orm)
File "/usr/local/lib/python3.10/dist-packages/aerich/utils.py", line 66, in get_tortoise_config
config_module = importlib.import_module(config_path)
File "/usr/lib/python3.10/importlib/init.py", line 128, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 992, in _find_and_load_unlocked
File "", line 241, in _call_with_frames_removed
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/rmf_demos_ws/src/rmf-web/packages/api-server/api_server/init.py", line 4, in
Tortoise.init_models(["api_server.models.tortoise_models"], "models")
File "/usr/local/lib/python3.10/dist-packages/tortoise/init.py", line 395, in init_models
app_models += cls._discover_models(models_path, app_label)
File "/usr/local/lib/python3.10/dist-packages/tortoise/init.py", line 355, in _discover_models
raise ConfigurationError(f'Module "{models_path}" not found')
tortoise.exceptions.ConfigurationError: Module "api_server.models.tortoise_models" not found
Do you have any ideas about this problem thanks.
hey @gurgenufuk12! Please post your logs in a code block or gist.github.com for easier reading
Could you provide more logs above these, including your previous few commands? It'll be helpful to find out if any steps were missed.
edit: It appears that you could be in the wrong directory when invoking these commands, with your directory structure, you will need to be in ~/rmf_demos_ws/src/rmf-web/packages/api-server
, is that correct?
I have been dealing with this issue by using sqlite3 but I have tried psql after having this problem and I changed the structure from using aerich now I am using brute force db.
But thanks for the response so quickly.