This is the backend for the membership portal.
It uses Auth0 for authentication / authorization and MailGun for sending email. However these features are disabled by default for local development.
We use Docker to run and develop the API. Whether you are running the API locally for developing the UI, or you are making changes to the API, I suggest you use Docker.
- Install docker-compose
- Create your
.env
config file for the projectcp example.env .env # edit .env and replace the email with your email address
If you don't need to make code changes to the API, the easiest way to get started is to just use docker compose to run the services. We created a dead-simple command for this:
make
If you need to make changes to the API, you will need to install the API locally
and use the make dev
command instead of make
. This will start the database,
run any necessary migrations, and then start the app in debug mode so that it
will pickup live updates when you save any changes.
-
Download and install dependencies
brew update brew install mysql pyenv
-
Download and install python
- Use pyenv to install python 3.6.1
pyenv install 3.6.1
- Source the python
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile echo 'eval "$(pyenv init -)"' >> ~/.profile
- (Optional) Source your
~/.profile
from your~/.bashrc
or~/.zshrc
# Always source the .profile on startup (to be shell agnostic) source $HOME/.profile
- You should now be able to see that you are using the shimmed python
which python # Should be $HOME/.pyenv/shims/python
-
Create a virtual environment (venv) for this project (read more about python 3 venv)
# from inside the repo python -m venv .
-
Activate the venv
# from inside the repo source bin/activate
You should now see
(membership_api)
to the left of your prompt in the terminal -
Install the python dependencies
- Verify that you are using the correct
pip
which pip # should be ./bin/pip
- Install the dev dependencies
pip install -r requirements-dev.txt
- Verify that you are using the correct
-
Run the server in debug mode
make dev
-
Verify that your API is up
curl http://localhost:8080/health # Should see {"health": true}
Congrats! You did it!
Help! I'm seeing some error. What do I do?
- Error Can't install Python 3.6.1 on Mac OSX, I'm seeing
zlib not available
Fix Download and install or upgrade XCode, and install the command line tools.
xcode-select --install