Skip to main content

Posts

Showing posts with the label scripting

Syncdb without creating a superuser in Django

I believe you have various situations when you require your syncdb command to be executed without creating a superuser, or prompting anything. Most obvious example is a scripting of some kind. E.g. custom deployment script. For this you have a --noinput option. You can then populate your db from json or someth. Like the one that is made with --dumpdata option. To run your syncdb without propting for creation of a superuser you need to run: python manage . py syncdb --noinput

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...