Refactor global code from plinth.py
Update .gitignore
Use Django messages module for showing messages