Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mkmanagementcommand(){
# creates a new management command
# arg1: app name
mkdir $1/management;
touch $1/__init__.py;
mkdir $1/management/commands;
touch $1/management/commands/__init__.py;
touch $1/management/commands/$2.py;
}
add_ci(){
# puts you straight into a commit message
git add --all;
git commit;
}
remkvirtualenv(){
# recreates a virtualenv
# arg1: virtualenv name
deactivate;
rmvirtualenv $1;
mkvirtualenv $1;
pip install -r requirements.txt;
clear;
}
v_switch(){
echo "switching vagrant box"
cd ~/projects/$1/to-vagrant/;
vagrant halt;
cd ~/projects/$2/to-vagrant/;
vagrant up;
workon $2;
cd ..;
echo "switched";
}
load_pg(){
# name of pg
# name of project
# must have to-vagrant
python ~/projects/admin-scripts/import_pgdump.py ~/projects/tech-ops/pg_dumps/$1 ~/projects/$2/to-vagrant;
cd ~/project/$2;
workon $2;
}
new_vagrant(){
# clones to-vagrant and starts the vm
git clone git@git.techops.cmich.edu:internal/to-vagrant.git;
cd to-vagrant;
vagrant up;
}
vup(){
vagrant up;
# vagrant ssh --command "sudo apt-get upgrade && sudo apt-get update";
}
remkmigrations(){
# recreates an initial migration file
# useful for messing around with django models
echo "remaking migrations for $1..";
echo "**before**";
ls $1/migrations;
echo "**removing**";
rm -rf $1/migrations/0001*;
ls $1/migrations;
echo "**makemigrations**";
python manage.py makemigrations $1;
ls $1/migrations;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.