Skip to content

Instantly share code, notes, and snippets.

@carlynorama
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlynorama/a2bc92e059aeab3e4fee to your computer and use it in GitHub Desktop.
Save carlynorama/a2bc92e059aeab3e4fee to your computer and use it in GitHub Desktop.
How to set up a new django project on a mostly fresh install of Mac OSX
#!/bin/sh
#assumes Xcode/gcc and FireFox installed
#install hombrew
#ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
#brew doctor
brew install python3 #includes pip3
pip3 install virtualenv
mkdir -p ~/$PATH/$SITENAME
mkdir -p ~/$PATH/$SITENAME/database
mkdir -p ~/$PATH/$SITENAME/static
mkdir -p ~/$PATH/$SITENAME/virtualenv
virtualenv --python=python3 virtualenv #put the virtualenv in the dirvirtualenv
cd virtualenv
source bin/activate
pip3 install django==1.7
#pip3 install https://github.com/django/django/archive/stable/1.7.x.zip
pip3 install --upgrade selenium
#pip3 install fabric
cd ~/$PATH/$SITENAME
django-admin.py startproject $PROJECTNAME
mv $PROJECTNAME source
cd source
git init .
#git config --global push.default simple
touch .gitignore
echo "db.sqlite3" >> .gitignore
echo "__pycache__" >> .gitignore
echo ".DS_Store" >> .gitignore
echo "*.pyc" >> .gitignore
touch README.md
git add .
git commit -m"initial django commit"
pip3 freeze > requirements.txt
mkdir functional_tests
cd functional_tests
touch test.py
echo "from selenium import webdriver
>
> browser = webdriver.Firefox()
> browser.get('http://localhost:8000')
>
> assert 'Django' in browser.title
> browser.quit()" >> test.py
git add .
git commit -am"added initial test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment