Skip to main content

Posts

Showing posts with the label bash

Django 1.5 migrating to new url tag syntax

Django 1.5 changed. The url tag syntax from {% url  my_page %} into {% url "my_page" %} . Now all my templates should be changed accordingly to migrate to 1.5. You could do it with executing this command in your bash shell. Assuming you are in the project folder. Assuming you have version control, or do know how to backup your work ;). Some people claim it is unsafe. But you may want to make it safer with adding '{%' to the beginning of the string. To make sure only templates arre changed. Or either execute this only in your templates folder to be sure. $ find . - type f - print0 | xargs - 0 sed - i 's/ url \([^" >][^ >]*\)/ url "\1"/g' And one person did a django snippet for this operation. You may also find it useful.  http://djangosnippets.org/snippets/2905/

Automating everyday system routine with Fabric (Python)

Lets talk about your console work. I use it on everyday basis. I need to log on to  my deployment/stage/whatever, server and do some redundancy. E.g. download some logs, clean up some caches and/or redeploy something. Here is the occasion, when  Fabric  comes handy. You can eliminate all the redundancy and cover tons of operations you need to do every day, using console, shortcutting them to one of your simple commands, like:  fab deploy_production -H root@mydeployment.com  interested? Let's move on then. Notie this command is not a masterpiece, but must give you the understanding of usual workflow. 1. Installation and purposes Let's go ahead, installing Fabric and automating some simple operations. You can read  official docs  about alternative methods. But installation is fairly simple. And is the matter of typing: $pip install fabric Nothing more special is required. You will need fabric at system wide scale. I install...