dkoug Blog

Bash script to create django project

Linux -- Posted on Feb. 20, 2019

Bash script to create django project

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
if [ $# -eq 0 ]
then
    echo "No arguments supplied"
    exit 1;
else
  mkdir -p $1
  cd $1
  python3 -m venv env
  source env/bin/activate
  pip install django django-debug-toolbar django-extensions python-memcached
  mkdir public
  pip freeze > requirements.txt
  django-admin startproject $1
  cd $1
  mkdir templates static
  cd templates
  touch index.html base.html
  cd ..
  pwd
fi