Save this shell script to the root of your Django project as "tags.sh", make it executable with "chmod +x tags.sh", and run it from the project root with "./tags.sh", and you will have a "tags" file for vim and a "TAGS" file for emacs.
Tags will be created for Python, JavaScript, and block names found in HTML templates. You may need to change "/usr/share/pyshared/django" to the location of your Django installation.
Documentation on Tags in emacs | Tags in vim
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh
:>TAGS
:>tags
for dir in . /usr/share/pyshared/django; do
find $dir -name '*.py' | etags -a -
find $dir -name '*.py' | ctags -a -
find $dir -name '*.js' | etags -a -
find $dir -name '*.js' | ctags -a -
find $dir -name '*.html' | etags -a --regex='/.*{%[ \t]+block[ \t]+\([^ \t%]+\)/\1/' -
find $dir -name '*.html' | ctags -a --regex='/.*{%[ \t]+block[ \t]+\([^ \t%]+\)/\1/' -
done
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 2 weeks ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 3 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 months ago
Comments
I do something like that, but instead of hardcoding '.' and '/usr/share/pyshared/django' for every project I am working on I tend to have 'PYTHONPATH' set up so I use this pattern:
#
Please login first before commenting.