The New SpartaHack API
Steps to run a local copy of SpartaHackAPI
-
Install virtualenv and virtualenvwrapper to the global python installation (source Virtualenv and Virtualenvwrapper)
pip3 install virtualenv
pip3 install virtualenvwrapper
And add the following three lines to your shell startup file (.zshrc, .bashrc, .profile, etc.)
Python location might change depending on what OS you are using(on MacOS it was stored in/usr/local/bin/python3
), for Ubuntu 16.04:export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 export WORKON_HOME=~/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh
-
Clone the API and cd into it
-
Create a virtualenv using
mkvirtualenv [VIRTUALENV_NAME]
using the virtualenvwrapper- Side Note: This will create the environment at the location you selected(the location put in your .zshrc)
-
Switch the python interpreter to the virtualenv using
workon [VIRTUALENV_NAME]
-
Install the dependencies using
pip install -r requirements.txt
-
Install RabbitMQ server using
sudo apt install rabbitmq-server
-
With RabbitMQ server running (it will after first install otherwise run it using
sudo rabbitmq-server
)sudo rabbitmqctl add_user dev mypassword
sudo rabbitmqctl add_vhost db_tasks
sudo rabbitmqctl set_user_tags dev database_tasks
sudo rabbitmqctl set_permissions -p db_tasks dev ".*" ".*" ".*"
Substitute
mypassword
with a good password and update the password inCELERY_BROKER_URL
variable in .env file acquired in the next step -
Get the enviorment file from Yash or Nate for accessing the important environment variables.
You're good to go!