-
Notifications
You must be signed in to change notification settings - Fork 7
Setting Up Development Environment Guide
Note that these commands were written with Ubuntu/Linux Mint in mind since they use apt. If you use another distribution, you may need to find the equivalent packages and commands for your system.
# Install Python
sudo apt-get install -y python
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
sudo apt-get install -y libffi-dev # For compiling bcrypt
# Install Postgres
sudo apt-get install -y postgresql
sudo apt-get install -y python-psycopg2
sudo apt-get install -y libpq-dev
# Install Node
sudo apt-get install -y nodejs npm
sudo ln -s `which nodejs` /usr/bin/node
# Install redis
sudo apt-get install -y redis# Install brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH="/usr/local/bin:$PATH"
source ~/.bash_profile
# Ensure brew is up to date
brew update
# Install Python
brew install python
# Install Postgres
brew install postgresql
# Install npm
brew install npm
# Install redis
brew install rediscd src-django/
pip install -r requirements.txtcd src-backbone/
npm install -g gulp jshint browserify mocha
npm installEnter the following commands into the terminal:
sudo -u postgres createuser --superuser sample_db_user
sudo -u postgres psql -c "ALTER USER sample_db_user WITH PASSWORD 'sample_db_password';"
sudo -u postgres createdb sample_db_nameThen export the required environment variables below. You may want to add these commands to your ~/.bashrc to save time in the future.
export DJANGO_SECRET_KEY='sample_secret_key'
export DJANGO_DB_NAME='sample_db_name'
export DJANGO_DB_USER='sample_db_user'
export DJANGO_DB_PASSWORD='sample_db_password'
export EMAIL_FROM='Sample Name <[email protected]>'
export EMAIL_HOST='smtp.example.com'
export EMAIL_HOST_USER='[email protected]'
export EMAIL_HOST_PASSWORD='sample_password'Start the postgres server in a terminal by entering:
postgres -D /usr/local/var/postgresThen enter these into a separate terminal:
sudo su _postgres
createuser --superuser sample_db_userInside the Postgres terminal enter:
\password sample_db_passwordOnce prompted for the password enter sample_db_password again and then exit with Ctrl+D. Finally enter:
createdb sample_db_nameFinally, export the required environment variables:
export DJANGO_SECRET_KEY='sample_secret_key'
export DJANGO_DB_NAME='sample_db_name'
export DJANGO_DB_USER='sample_db_user'
export DJANGO_DB_PASSWORD='sample_db_password'
export EMAIL_FROM='Sample Name <[email protected]>'
export EMAIL_HOST='smtp.example.com'
export EMAIL_HOST_USER='[email protected]'
export EMAIL_HOST_PASSWORD='sample_password'In one terminal window:
cd src-django
./manage migrate
./manage runserverIn another terminal window:
cd src-backbone
gulp debugIn a new terminal window, start redis:
redis-serverIn order to have your local development send emails, start Celery:
celery --app=sanaprotocolbuilder.celery:app worker --loglevel=INFOThese are optional but highly recommended.
cd scripts/
chmod +x setup_hooks.sh
./setup_hooks.sh