Login

Tag "bash"

Snippet List

update-django: Update your django git branches.

This is the (revamped) bash script I use to keep my git branches up-to-date with SVN to make my life a lot easier, just save it in a text file and read the instructions at the top! Hope it's useful to somebody else than me ;)

  • bash
  • merge
  • update
  • svn
  • git
Read More

Use django-admin.py instead of manage.py

A lot of people new to Django don't realize that `manage.py` is [just a wrapper](http://www.djangoproject.com/documentation/django-admin/) around the `django-admin.py` script installed with Django and isn't needed. (You may need to symlink `django-admin.py` to someplace in your system `PATH` such as `/usr/local/bin`.) The most important thing it does is to set your `PYTHONPATH` and `DJANGO_SETTINGS_MODULE` environment variables before calling `django-admin.py`. Those same settings are needed when you move your site on to a production server like Apache, so it is important to know how they work. This shell function sets those variables for you. Put it in your `.zshrc` or bash startup script. It works for both the monolithic project style and the lightweight app style of Django development [[1](http://www.pointy-stick.com/blog/2007/11/09/django-tip-developing-without-projects/)], [[2](http://www.b-list.org/weblog/2007/nov/09/projects/)]. This function isn't fancy; drop a comment if you have an improvement. Written for zsh and tested with bash 3.1.17.

  • bash
  • shell
  • zsh
Read More

pyserver -- runserver alias

I use Django's built-in development server all the time, but get tired of typing out the command to run it, and if I'm testing some custom admin css/js, I *really* get tired of typing out the command that correctly directs the middleware to use my admin media dir. So I added this alias to my .bashrc and when I'm in a project's root, I just type 'pyserver' and the development server fires up, automatically passing an --adminmedia arg if I have some custom admin media for the project (otherwise it's 'runserver' as always). Note: This relies on the convention that my custom admin media will be in a folder called admin_media that resides at the project's base. Of course, change it to whatever convention you use. I'm not a bash expert or anything, but this works for me ;)

  • bash
  • runserver
Read More

run "silent" dev server

This will hide the scrolling output from the development server so you can ssh and run the server in peace, for those of us with only one SSH session active developing on a remote server.

  • bash
  • runserver
  • daemon
Read More

5 snippets posted so far.