-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
74 lines (63 loc) · 2.27 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
platform='mac'
fi
if [[ "$platform" == 'linux' ]]; then
if hash mysql 2>/dev/null; then\
sudo apt-get install mysql-server
fi
if hash mysql_config 2>/dev/null; then
sudo apt-get install libmysqlclient-dev
fi
sudo apt-get install mysql-server
elif [[ "$platform" == 'mac' ]]; then
# Check if brew is installed
which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
# https://github.com/mxcl/homebrew/wiki/installation
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
else
brew update
fi
# Check if Git is installed
which -s git || brew install git
# Check if mysql is installed
which -s mysql || brew install mysql
fi
# check for previous installations
if [ -d "virtual-environment" ]; then
sudo rm -rf virtual-environment
echo "Enter mysql root password:"
read -s password
if [[ "$password" == "" ]]; then
mysql -u root -e "DROP DATABASE IF EXISTS housing;"
mysql -u root -e "DROP USER 'housing'@'localhost'";
mysql -u root -e "CREATE DATABASE housing;"
mysql -u root -e "CREATE USER 'housing'@'localhost' IDENTIFIED BY '123';"
mysql -u root -e "GRANT ALL PRIVILEGES ON housing . * TO 'housing'@'localhost';"
mysql -u root -e "FLUSH PRIVILEGES;"
else
mysql -u root -p$password -e "DROP DATABASE IF EXISTS housing;"
mysql -u root -p$password -e "DROP USER 'housing'@'localhost'";
mysql -u root -p$password -e "CREATE DATABASE housing;"
mysql -u root -p$password -e "CREATE USER 'housing'@'localhost' IDENTIFIED BY '123';"
mysql -u root -p$password -e "GRANT ALL PRIVILEGES ON housing . * TO 'housing'@'localhost';"
mysql -u root -p$password -e "FLUSH PRIVILEGES;"
fi
fi
# Check if pip is installed
which -s pip || sudo easy_install pip
# Check if virtualenv is installed
which -s virtualenv || sudo pip install virtualenv
virtualenv virtual-environment
source activate
pip install -r requirements.txt
python src/manage.py makemigrations properties
python src/manage.py syncdb
python src/manage.py loaddata brokers
python src/manage.py loaddata properties
python src/manage.py loaddata graphs