Version 2 (modified by Antti Kaihola, 11 years ago) (diff)

added svn up $MRP

You can make your life a bit easier by defining Unix shell aliases and environment variables and functions for Django paths and commands. They can be set e.g. in $HOME/.bash_aliases to be loaded automatically.

If you have installed Django in your site-packages, you could use something like:

alias djadmin='$DJBIN/'
djgrep() {
  grep -r --include="*.py" --include="*.html" $* $DJ

Then you'll be able to:

$ djadmin startproject myproject
$ less $DJ/docs/overview.txt
$ djgrep Permissions
/usr/lib/python2.4/site-packages/django/contrib/auth/            (_('Permissions'), {'fields': ('is_staff', 'is_active', 'is_superuser', 'user_permissions')}),

Here's another example for those who don't keep their Django tree in PYTHONPATH (e.g. because of using many different Django versions). In this case the magic-removal branch is located in the user's home directory.

MRP=/home/akaihola/magic-removal  # MRP stands for Magic-Removal Pythonpath
alias mradmin='PYTHONPATH=$MRP $MRBIN/'
mrgrep() {
  grep -r --include="*.py" --include="*.html" $* $MR

And some useful idioms using these shortcuts:

$ svn up $MRP
$ mradmin startproject myproject
In [1]:import django
In [2]:django.__file__
Back to Top