Setting up a complete GeoDjango development environment on OS X

31.03.2014: homebrew progressed quite a lot and it’s much easier now to setup a complete  GeoDjango environment like this:

ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”

brew install python
brew install postgis15
(OR: brew install homebrew/versions/postgis15)

Run this command to autorun PostgreSQL when OS X fires up:
cp /usr/local/Cellar/postgresql9/9.0.17/homebrew.mxcl.postgresql9.plist ~/Library/LaunchAgents/

brew install graphicsmagick
brew install gs
brew link gs
brew install git
brew install mercurial
brew install autoenv

brew install nodejs
npm install -g less
npm install -g typescript

pip install virtualenv
sudo pip install virtualenvwrapper

~/.bash_profile only contains these three lines:
export PATH=/usr/local/bin:$PATH
export WORKON_HOME=~/PythonEnvs
source /usr/local/bin/virtualenvwrapper.sh

mkvirtualenv -p /usr/local/bin/python django15
workon django15
pip install django-cms

initdb /usr/local/var/postgres

createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql

psql -d postgres -c “UPDATE pg_database SET datistemplate=’true’ WHERE datname=’template_postgis’;”

psql -d template_postgis -f /usr/local/Cellar/postgis15/1.5.8/share/postgis/postgis.sql

psql -d template_postgis -f /usr/local/Cellar/postgis15/1.5.8/share/postgis/spatial_ref_sys.sql

Enabling users to alter spatial tables:

psql -d template_postgis -c “GRANT ALL ON geometry_columns TO PUBLIC;”
psql -d template_postgis -c “GRANT ALL ON spatial_ref_sys TO PUBLIC;”

createdb -T template_postgis PROJECT


UPGRADES & UPDATES:

brew doctor
brew update
brew upgrade
pip install –upgrade pip
pip install –upgrade -r requirements.txt


USER INSTALLED VS. OS X DEFAULTS:

User installed:

/Applications/Python 2.7/
/Library/Frameworks/Python.framework
/Library/Frameworks/Python.framework/Versions/Current/bin/python
/usr/local/bin/python

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/Current/bin/python

OS X installed by default:

/Library/Python
/Library/Python/2.3
/Library/Python/2.5
/Library/Python/2.6
/Library/Python/2.7
/System/Library/Frameworks/Python.framework
/System/Library/Frameworks/Python.framework/Python
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/python.o
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/idlelib/Icons/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.3/Python
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python-config
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC/objc/_pythonify.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC/objc/_pythonify.pyc
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/python_dateutil-1.5-py2.5.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python-ast.h
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pythonrun.h
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config/libpython2.5.a
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config/libpython2.5.dylib
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config/python.o
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/test/test_python_api.py
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/test/test_python_api.pyc
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ctypes/test/test_python_api.pyo
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/idlelib/Icons/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Python-2.5.6-py2.5.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.5/Python
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/Resources/English.lproj/Documentation/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/Resources/English.lproj/Documentation/pythonsmall.gif
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/Resources/PythonApplet.icns
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/Resources/PythonInterpreter.icns
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python-config
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/matplotlib/sphinxext/ipython_console_highlighting.py
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/matplotlib/sphinxext/ipython_console_highlighting.pyc
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/_pythonify.py
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/_pythonify.pyc
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/python_dateutil-1.5-py2.6.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/trial/test/notpython
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python-ast.h
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pythonrun.h
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/libpython2.6.a
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/libpython2.6.dylib
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/python.o
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/test/test_python_api.py
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/test/test_python_api.pyc
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/test/test_python_api.pyo
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/idlelib/Icons/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/Python-2.6.8-py2.6.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/test/https_svn_python_org_root.pem
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/test/svn_python_org_https_cert.pem
/System/Library/Frameworks/Python.framework/Versions/2.6/Python
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/pythonsmall.gif
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/PythonApplet.icns
/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/PythonInterpreter.icns
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/sphinxext/ipython_console_highlighting.py
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/sphinxext/ipython_console_highlighting.pyc
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_pythonify.py
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_pythonify.pyc
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/python_dateutil-1.5-py2.7.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/trial/test/notpython
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python-ast.h
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pythonrun.h
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig/python-2.7.pc
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig/python.pc
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/pkgconfig/python2.pc
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.a
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/python.o
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/test/test_python_api.py
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/test/test_python_api.pyc
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/test/test_python_api.pyo
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/Icons/python.gif
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/Python-2.7.5-py2.7.egg-info
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/https_svn_python_org_root.pem
/System/Library/Frameworks/Python.framework/Versions/2.7/Python
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/BridgeSupport/Python.bridgesupport
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/Resources/PythonApplet.icns
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/Resources/PythonInterpreter.icns
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/Inline/Python
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/Inline/Python/Python.bs
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/Inline/Python/Python.bundle
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/Inline/Python.pm
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/Inline/Python.pod
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/Inline/Python
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/Inline/Python/Python.bs
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/auto/Inline/Python/Python.bundle
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/Inline/Python.pm
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/Inline/Python.pod
/usr/bin/python
/usr/bin/python-config
/usr/bin/python2.5
/usr/bin/python2.5-config
/usr/bin/python2.6
/usr/bin/python2.6-config
/usr/bin/python2.7
/usr/bin/python2.7-config
/usr/bin/pythonw
/usr/bin/pythonw2.5
/usr/bin/pythonw2.6
/usr/bin/pythonw2.7
/usr/lib/libpython.dylib
/usr/lib/libpython2.5.dylib
/usr/lib/libpython2.6.dylib
/usr/lib/libpython2.7.dylib
/usr/lib/python2.5
/usr/lib/python2.6
/usr/lib/python2.7
/usr/share/emacs/22.1/lisp/progmodes/python.el.gz
/usr/share/emacs/22.1/lisp/progmodes/python.elc
/usr/share/file/magic/python
/usr/share/man/man1/python.1
/usr/share/man/man1/python2.5.1
/usr/share/man/man1/python2.6.1
/usr/share/man/man1/python2.7.1
/usr/share/man/man1/pythonw.1
/usr/share/man/man1/pythonw2.5.1
/usr/share/man/man1/pythonw2.6.1
/usr/share/man/man1/pythonw2.7.1
/usr/share/vim/vim73/autoload/python3complete.vim
/usr/share/vim/vim73/autoload/pythoncomplete.vim
/usr/share/vim/vim73/ftplugin/python.vim
/usr/share/vim/vim73/indent/python.vim
/usr/share/vim/vim73/syntax/python.vim
/usr/share/zsh/5.0.2/functions/_python


UNINSTALL:

1. uninstall homebrew: http://superuser.com/questions/203707/how-to-uninstall-homebrew-osx-package-manager

2. uninstall pip:
rm -rf /usr/local/lib/python2.7
rm -f /usr/local/bin/pip
rm -f /usr/local/bin/pip-2.6
rm -f /usr/local/bin/pip-2.7
rm -f /usr/local/bin/hg


TACKLING PROBLEMS:

Error running xgettext. Note that Django internationalization requires GNU gettext 0.15 or newer.

ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/autopoint /usr/local/bin/autopoint
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/envsubst /usr/local/bin/envsubst
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/gettext /usr/local/bin/gettext
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/gettext.sh /usr/local/bin/gettext.sh
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/gettextize /usr/local/bin/gettextize
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgattrib /usr/local/bin/msgattrib
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgcat /usr/local/bin/msgcat
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgcmp /usr/local/bin/msgcmp
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgcomm /usr/local/bin/msgcomm
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgconv /usr/local/bin/msgconv
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgen /usr/local/bin/msgen
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgexec /usr/local/bin/msgexec
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgfilter /usr/local/bin/msgfilter
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgfmt /usr/local/bin/msgfmt
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msggrep /usr/local/bin/msggrep
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msginit /usr/local/bin/msginit
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgmerge /usr/local/bin/msgmerge
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msgunfmt /usr/local/bin/msgunfmt
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/msguniq /usr/local/bin/msguniq
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/ngettext /usr/local/bin/ngettext
ln -s /usr/local/Cellar/gettext/0.18.3.2/bin/xgettext /usr/local/bin/xgettext

Error: [Errno 8] nodename nor servname provided, or not known: http://stackoverflow.com/questions/12102236/wsgiserverexception-errno-8-nodename-nor-servname-provided-or-not-known/23471411#23471411

DatabaseError: could not access file “$libdir/postgis-1.5″: No such file or directory
The file /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so is missing. This error happened after brew upgrade and the solution is to uninstall postgis and reinstall it with:

brew uninstall postgis15
brew install postgis15

The result should be: PostGIS plugin libraries installed to: /usr/local/Cellar/postgresql9/9.0.17/lib

So afterwards you should find the file /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so


Set it up like we did in the past:

http://blog.philippmetzler.com/django-install-osx/topics/install-osx.html

Can you believe it?! The viewport for mobile devices also depends on the TLD

Webbrowsers that use the Webkit engine (Safari Mobile @ iOS, Google Chrome @ iOS) ignore viewport settings for content that is served from .MOBI domains and render content differently than content that is served from .COM domains!

https://bugs.webkit.org/show_bug.cgi?id=97556

http://www.davidroessli.com/logs/2010/04/safari_ignores_viewport_mobi_domains/

http://blog.planetargon.com/entries/2012/4/17/the-mobile-viewport-short-and-sweet

Ajax foreign key filter in Django admin interface

We have a solution to the problem now! So first the solution and then the problem:

http://github.com/digi604/django-smart-selects

The problem:

http://code.google.com/p/django-ajax-filtered-fields/

Just tried django-ajax-filtered-fields and like it very much. I’m looking for a solution for this problem:

My model looks like this:

class Artist(models.Model):

class Song(models.Model):
    artist = models.ForeignKey(Artist)
    album = models.ForeignKey(Album, blank=True, null=True)
class Album(models.Model):
    artist = models.ForeignKey(Artist)

So the user has to define an an artist when adding a song. He can also define an album but doesn’t have to. The album belongs to an artist.

In the Django admin interface I’d like to limit the choices for albums based upon what he selects in the field “artist”. That should change dynamically with AJAX. I will have a closer look to django-ajax-filtered-fields but didn’t find a solution to that specific problem. Are there plans to include such functionality in the Django admin interface?

The ajax filter should work with more than two levels also. For instance if there is an additional class like

class RecordLabel(models.Model):
    artist = models.ForeignKey(Artist)

So if i select a record label the choices for artist should be filtered based upon the selected record label the artist is signed to.

Perhaps it’s another usecase for django-ajax-filtered-fields in general? Or do you know another solution to my specific requirements?

Discussion in the Django developers group: http://groups.google.com/group/django-developers/browse_thread/thread/daa3bcdfa247c2ed


http://github.com/alex/django-filter
Django-filter is a reusable Django application for allowing users to filter queryset dynamically. But it seems not to be suitable for the admin interface.

See also:

http://stackoverflow.com/questions/12170267/django-filter-many-to-many-field-in-admin

http://django-selectable.readthedocs.org/en/version-0.5.2/advanced.html#chained-selection

http://django-autocomplete-light.readthedocs.org/en/latest/dependant.html

Just using raw_id_fields which provides a filter and a search field: http://www.thecssdiv.co.uk/2008/09/django-raw-id-fields-explained-basically/

Just with jQuery AJAX: http://harvesthq.github.io/chosen/

Add a collection / product overview page to a Shopify shop

Example: http://gastrotech.myshopify.com/collections

Taking control of the collections listing page: http://wiki.shopify.com/Taking_control_of_the_collections_listing_page

Shopify Theme Guide: http://wiki.shopify.com/The_Shopify_Theme_Guide

Use this template:

<div id="collections-listing">
   {% if collections.present? %}
   <h2>Kategorien</h2>

   {% for collection in collections %}
   <a href="{{collection.url}}">
   <div>

       {% for temp in collection.all_products limit: 1 %}
       <div>
           <img src="{{ temp.images.first | product_img_url: 'small' }}" />
       </div>
       {% endfor %}

       <div>
           <div>{{ collection.title }}</div>
           <small>{{ collection.products_count }} Artikel</small>
       </div>
 
    </div>
    </a>
    {% endfor %}

    {% else %}

    <p>Keine Kategorien gefunden...</p>

    {% endif %}
</div>

Colorize git messages


error: git-checkout-index: unable to create file public/media/uploads/pdf/dummy1.pdf (Permission denied)
error: git-checkout-index: unable to create file public/media/uploads/pdf/dummy2.pdf (Permission denied)
fatal: merging of trees 78c30151ebcf0866a8bb0b0ad82dc9cf9e0b697a and 7cf25a39a86b53564eed4b9c11b281033693c1e5 failed
Merge with strategy recursive failed.

In order to colorize the error messages (red please) of git you can edit your ~/.bash_profile

HIGHLIGHT=`echo -e ‘\033[31m\033[1m'`
NORMAL=`echo -e '\033[0m'`
alias gpull="git pull 2>&1 | sed -E -e 's/error:|warning:|fatal:/$HIGHLIGHT&/'; echo $NORMAL; ./manage.py collectstatic --noinput; ./manage.py syncdb; ./manage.py migrate --list; echo '*** git pull: DONE *** collect static: DONE *** syncdb: DONE *** migrations available? *** apply migrations manually!'"
alias gpush="git push 2>&1 | sed -E -e 's/error:|warning:|fatal:/$HIGHLIGHT&/'; echo $NORMAL; maintenance/update_server.sh"
# alias gcomm="git commit -a; maintenance/utest.py"
alias gcomm="git commit -a;"
alias dumpd="./manage.py dumpdata >fixtures/all.json --indent 4"
alias loadd="./manage.py loaddata fixtures/all.json"

alias runserver="./manage.py create_sample_data; ./manage.py runserver_plus --cert cert COMPUTERNAME.local:8000"
alias runserverhttp="./manage.py create_sample_data; ./manage.py runserver_plus COMPUTERNAME.local:8000"
alias runserverorig="./manage.py runserver COMPUTERNAME.local:8000"

alias shell="./manage.py shell_plus"

#alias syncdb="./manage.py syncdb --verbosity 2"
alias syncdb="./manage.py syncdb"
alias dbinit="./dbinit.py"
alias editmsgs="nano locale/de/LC_MESSAGES/django.po"
alias makemsgs="django-admin.py makemessages -a --verbosity=2"
alias compilemsgs="django-admin.py compilemessages"
alias clearthumbs="./manage.py thumbnail cleanup; ./manage.py thumbnail clear; echo 'Server neu starten damit die Thumbnails neu erzeugt werden!'"

#alias unittest="./manage.py test"
# Das jeweilige Projekt definiert was genau getestet werden soll:
alias unittest="./utest.py"


git itself also supports colors - e.g. for files that are not yet added to the repository. edit .git/config like this:

[color]
branch = always
diff = always
grep = always
interactive = always
pager = true
showbranch = auto
status = auto
ui = always

[color "interactive"]
error = red bold

[color "branch"]
current = yellow reverse
local = yellow
remote = green

[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold

[color "status"]
added = yellow
changed = green