{"id":368,"date":"2012-01-04T09:44:59","date_gmt":"2012-01-04T08:44:59","guid":{"rendered":"http:\/\/daniel.hepper.net\/blog\/?p=368"},"modified":"2012-01-04T10:12:46","modified_gmt":"2012-01-04T09:12:46","slug":"easy-django-management-commands-with-autogenerated-aliases","status":"publish","type":"post","link":"https:\/\/daniel.hepper.net\/blog\/2012\/01\/easy-django-management-commands-with-autogenerated-aliases\/","title":{"rendered":"Easy Django management commands with autogenerated aliases"},"content":{"rendered":"<p>Recently, I got sick of typing <code>django-admin.py &lt;command&gt;<\/code> to run Django management commands and decided that something must be done about it. This is what I came up with:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/1556506.js\"> <\/script><\/p>\n<p>This little script creates short aliases for all available Django management commands. Typing this every time you want to work on your project obviously defeats the point, so I added it to <code>bin\/activate<\/code> which is created by virtualenv (you do use <a href=\"http:\/\/www.virtualenv.org\/\">virtualenv<\/a>, don&#8217;t you?). I actually do this in a bootstrap script, using this snippet:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/1559119.js\"> <\/script><\/p>\n<p>If you use <a href=\"http:\/\/www.doughellmann.com\/docs\/virtualenvwrapper\/\">virtualenvwrapper<\/a>, you can append the script to the <code>bin\/postactivate<\/code> script instead.<\/p>\n<p>I know there is bash completion for Django management commands. The advantage of my solution is that it is available for every developer on the project after running the bootstrap script. And it is one character less to type.<\/p>\n<p>To run <code>django-admin.py syncdb<\/code>, just type <code>djsy&lt;TAB&gt;<\/code> instead of <code>dj&lt;TAB&gt;sy&lt;TAB&gt;<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I got sick of typing django-admin.py &lt;command&gt; to run Django management commands and decided that something must be done about it. This is what I came up with: This little script creates short aliases for all available Django management &hellip; <a href=\"https:\/\/daniel.hepper.net\/blog\/2012\/01\/easy-django-management-commands-with-autogenerated-aliases\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-368","post","type-post","status-publish","format-standard","hentry","category-django"],"_links":{"self":[{"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":5,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":372,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions\/372"}],"wp:attachment":[{"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.hepper.net\/blog\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}