Open martonvago opened 3 months ago
If we don't have a database in core
and don't depend on Django, then this is not needed. (See this comment.)
Wonderful, thanks for this! I think we can keep this as a lower priority, and implement the actual CLI later. But at least make sure to design what ever we build with this in mind 😁
We want CLI commands to be accessible directly in the terminal (e.g.
> my-command --option 3
) when Sprout is installed, so we have to add our commands as entry points inpyproject.toml
. This is a more complex setup than using custom admin commands (e.g.> python manage.py my-command --option 3
). When the app is accessed directly through a command, so not viamanage.py
, Django and the database have to be set up manually, including pointing to the settings file, runningdjango.setup()
and running the migrations. Ideally (perhaps), these setup commands would be run once in a sort of post-install step, not before every command.I’m not 100% sure what the best strategy would be for this, some possible options:
setup.py
file with a post-install stepNote that even if we can avoid having Django as a dependency of the core app, the database still needs to be initialised before we can run CLI commands that access it.
Related: https://github.com/seedcase-project/seedcase-sprout/issues/479