2020-01-02 02:33:41 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
test -z $1 && echo "Please provide a project name!" && exit 1
|
|
|
|
test -d $dev/$1 && echo "That project already exists!" && exit 1
|
|
|
|
|
|
|
|
mkdir $1 && cd $1
|
|
|
|
pip3 freeze > requirements.txt
|
2020-01-31 18:43:15 +00:00
|
|
|
example_dir=$(python3 -c 'import os,example;print(os.path.dirname(example.__file__))')
|
2020-01-05 12:37:51 +00:00
|
|
|
cp -r $example_dir/{project,app,manage.py} .
|
2020-01-02 02:33:41 +00:00
|
|
|
sed -i s/example/$1/ project/settings.py
|
|
|
|
|
|
|
|
# Assume the user has sudo access to postgres
|
|
|
|
sudo su postgres -c "createuser $1; createdb -O $1 $1" || true
|
|
|
|
|
|
|
|
cat << EOF > .gitignore
|
|
|
|
*.pyc
|
|
|
|
__pycache__/
|
|
|
|
EOF
|
|
|
|
|
2020-01-05 12:37:51 +00:00
|
|
|
./manage.py makemigrations app
|
2020-01-02 02:33:41 +00:00
|
|
|
./manage.py migrate
|
|
|
|
./manage.py createsuperuser
|
|
|
|
./manage.py runserver --nostatic
|