You should never download a file before checking it, but here you go: just put the function run in your ~/.zshrc
.
curl https://gist.githubusercontent.com/corentinbettiol/689d5d9f0989b2f71613b56ab5bc67f6/raw/run.sh >> ~/.zshrc
source ~/.zshrc
Suppose you have this structure for your multisite-with-one-database django project:
mydumbwebsite/
- src/
- website/
- apps/
- settings/
- urls.py
- [...]
- intranet/
- apps/
- [...]
- other_website/
- apps/
- [...]
- config files [...]
And you're using poetry.
In order to launch a command from the website
site, you need to execute this command:
poetry run python3 src/website/manage.py <command>
What's all this poetry run python3 src/website/manage.py
crap? Why can't we have a thing similar to the ol' good django-admin
command (but shorter)?
Run makes it easy to run a command on the "default" website
site:
run <command>
But now you want to run a command on the other_website
site.
You can do that with this command:
poetry run python3 src/other_website/manage.py <command>
run -other_website loaddata things.json
Just add the site name after a -
char, and the command will be launched on this website!
What's even better than a simple, short command that allows you tu run commands on multiple websites?
A way to share this command.
run
will print the complete command (in a dim style for your convenience), so you can share this command to other people that do not know about run.
How cool is that?