Last active
September 13, 2024 19:18
-
-
Save banagale/4293da66869538d212a59a1b72a44dc5 to your computer and use it in GitHub Desktop.
Shortcuts to common django management commands for a project running poetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Django-related shell functions for zsh | |
# Run development server | |
function runserver() { | |
poetry run python ./manage.py runserver "$@" | |
} | |
# Run tests | |
function runtests() { | |
poetry run python ./manage.py test "$@" | |
} | |
# Create migrations | |
function makemigrations() { | |
poetry run python ./manage.py makemigrations "$@" | |
} | |
# Migrate database | |
function migrate() { | |
poetry run python ./manage.py migrate "$@" | |
} | |
# Migrate and Sync | |
function update() { | |
cd ~/code/weave/weave-service/ | |
poetry run python ./manage.py migrate "$@" | |
poetry run python manage.py syncdata modules.json,module_documents.json,chains.yaml,recipes.json,recipe_chains.json,sections.yaml,document_type.json,global_templates.json | |
} | |
# Open Django shell | |
function dshell() { | |
poetry run python ./manage.py shell "$@" | |
} | |
# Collect static files | |
function collectstatic() { | |
poetry run python ./manage.py collectstatic --noinput | |
} | |
# Check for code issues | |
function check() { | |
poetry run python ./manage.py check "$@" | |
} | |
# Create superuser | |
function createsuperuser() { | |
poetry run python ./manage.py createsuperuser | |
} | |
# Database dump | |
function dumpdata() { | |
poetry run python ./manage.py dumpdata "$@" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment