Code

Changes between Initial Version and Version 1 of DjangoSettingsBashFunction


Ignore:
Timestamp:
12/27/05 01:42:52 (8 years ago)
Author:
jim-django@…
Comment:

created page.

Legend:

Unmodified
Added
Removed
Modified
  • DjangoSettingsBashFunction

    v1 v1  
     1I've set up a quick shell function in my .bashrc which sets the DJANGO_SETTINGS_MODULE environment variable for me, allowing tab completion. 
     2 
     3The function is: 
     4 
     5 
     6{{{ 
     7django-settings () 
     8{ 
     9    export DJANGO_SETTINGS_MODULE=$1.settings 
     10} 
     11}}} 
     12 
     13 
     14pop that into your ~/.bashrc and for your next logins, you'll be able to do something like the following: 
     15 
     16 
     17 
     18{{{ 
     19$ cd projects 
     20$ dja<tab>s<tab> my<tab> 
     21}}} 
     22 
     23 
     24which will autocomplete to {{{django-settings myproject}}}, and sets DJANGO_SETTING_MODULE to myproject.settings. 
     25 
     26I presume here that you operate out of a "projects" directory which is on your pythonpath.