Tag Archives: shell

Quickly Start a Django Project

There are many things I like to do when starting a django project. I started to compile those in a script I’m using. The gist is linked below.

New Django Project.sh

#!/bin/bash
# 
# Author: Abdallah Deeb 
# Requirements: python, pip, virtualenv, virutalenvwrapper, git
#
# Edit the following 2 lines
PROJECTNAME=proj
APPNAME=myapp
if [ -n "$2" ]
then 
  APPNAME="$2"
fi
if [ -n "$1" ]
then 
  PROJECTNAME=$1
fi

source `which virtualenvwrapper.sh` 

echo "Starting a new Django project: $PROJECTNAME"
# Make a virtualenv
mkvirtualenv $PROJECTNAME

# Install latest django and start the project/app
pip install django
django-admin.py startproject $PROJECTNAME
cd $PROJECTNAME
django-admin.py startapp $APPNAME
mv $PROJECTNAME conf

# conf is much nicer than projname
replace $PROJECTNAME conf -- manage.py conf/settings.py conf/wsgi.py conf/urls.py
chmod +x manage.py
workon $PROJECTNAME

# Initialize and use git
git init
git add .
git commit -a -m 'initial commit'

and the raw gist download

Similar Posts:

Tagged , , , ,

CLI blogging with Postie (via postie)

Bookmark this category
Another blogging test using the postie plugin

Similar Posts:

Tagged , , ,

Quick Note

Testing the previous entry, and quick-blogging from the shell

Similar Posts:

    None Found

Tagged , ,

Dave’s Notepad

We were chatting in the morning and my colleague Dave said:

echo “blog post about distro choice” | mail -s “blog post” david@mydomain.org
that’s my ‘notepad’. 🙂

I thought that was pretty useful, but tried to make it easier by creating a bash alias. Turns out it’s better to use a bash function instead. (see this note). So my ‘jot’ function is:
function jot() { echo "$1" | mail -s "$2" abdallah@mydomain.com; }

I also noticed, that emails sent from my laptop were not reaching. It seems Ubuntu comes with Exim4 as a default MTA. I’m not too familiar with Exim, so I used the occasion to learn a new trick.

I might use this for micro-blogging next… let me go set it up 🙂

Similar Posts:

Tagged , , , , , , , , ,

Moving SVN repository

I moved the svn repository from my laptop to the server for easier deployment of http://mybox.grat.in
Here are the commands I used:

on laptop:
svnadmin dump /var/svn/repos/ > home-repository.dmp
gzip home-repository.dmp
scp -P39227 home-repository.dmp.gz mybox.server.xx:/home/myuser

on server:
mkdir -p /var/svn/repos
gunzip home-repository.dmp.gz
cd /var/svn/repos/
svnadmin load /var/svn/repos < /home/myuser/home-repository.dmp

again on laptop:
edited ~/.subversion/config:
[tunnels]
sshtunnel = ssh -p 39227

then:
svn switch --relocate file:///var/svn/repos/ svn+sshtunnel://mybox.server.xx/var/svn/repos/

And check it's all good (in the working copy directory):
svn up
svn info

Piece of cake 🙂

Similar Posts:

Tagged , , ,