Skip to content

@pramodliv1 /django_one_step.sh
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Script to create django project with virtualenv
#!/bin/bash
#Take project name as input
if [ -z "$1" ]
then
echo "Enter project name"
read proj
else
proj="$1"
fi
#Create a virtualenv
virtualenv $proj
cd $proj
source bin/activate
#Install django within the virtualenv
echo "PIP_RESPECT_VIRTUALENV=true" >> bin/activate
touch requirements.txt
echo "django" >> requirements.txt
pip install -r requirements.txt
#Create project
python lib/python2.7/site-packages/django/bin/django-admin.py startproject $proj
#Set default environment variables
export DJANGO_SETTINGS_MODULE="$proj.settings"
export PYTHONPATH="$VIRTUAL_ENV/$proj"
#Write the variables into activate for future use.
echo "export DJANGO_SETTINGS_MODULE=$proj.settings" >> bin/activate
echo "export PYTHONPATH=$VIRTUAL_ENV/$proj" >> bin/activate
#Reset virtualenv and we are ready
deactivate
source bin/activate
@pramodliv1
Owner

Usage:
$ chmod +x django_one_step.sh
$ ./django_one_step.sh your_project

http://intendindent.blogspot.in/2012/10/script-to-create-django-project-with.html

@pramodliv1
Owner

Oops, missed out one more command
$ chmod +x django_one_step.sh
$ ./django_one_step.sh your_project
$ source bin/activate

@pramodliv1
Owner

OK, hopefully final change to usage. Now it's truly one-step.

$ source django_one_step.sh

http://stackoverflow.com/questions/13098457/installing-django-with-pip-django-admin-not-found/13099492#13099492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.