- 📝 ohack.dev frontend code is here
- This code is the backend api.ohack.dev and supports ohack.dev frontend.
- Like most things we build, to keep it simple, this runs on Heroku.
- We borrowed the code from Auth0 here to bootstrap our development (always a good practice)
- If you plan on doing database work, see our guide to cloning our Firebase Firestore Database
-
Use this doc to setup GitHub Codespaces: you won't need to download anything on your computer
-
Install Python modules
pip install -r requirements.txt
- Run the app
flask run
- Create a
.env
file under the root project directory and populate it with the contents listed in our doc here
- Review these instructions
- Install Heroku CLI
- Run via
heroku local
command
Create a virtual environment. You can use:
- Miniconda (preferred)
- Virtual Env (venv)
- Anaconda
- Don't create a virtual environment at all and trample on a single Python environment you might already have
What are the diffs between Miniconda and Anaconda? See this
You'll need to run Python 3.9.13 (see runtime.txt) to match the same version that Heroku runs.
Once you have a virtual environment ready, you will want to install the project dependencies:
pip install -r requirements.txt
Create a .env
file under the root project directory and populate it with the following content:
You will need to get these values from our Slack channel.
# Flask Settings
FLASK_APP=api
FLASK_RUN_PORT=6060
FLASK_ENV=development
PORT=6060
CLIENT_ORIGIN_URL=
# Firebase Settings
FIREBASE_CERT_CONFIG=
OPENAI_API_KEY=
#Propel Auth Settings
PROPEL_AUTH_KEY=
PROPEL_AUTH_URL=
Run the project in development mode:
flask run
Set the interpreter via the command pallete Python: Select Interpreter
(source)[https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters]
- Firestore UI
- Using Python with Firestore
- Querying Firestore with Python
- Auth0 Python Flask boilerplate used to start this repo
- Setting up a fully functional database in Firebase Emulator
- Get gCloud CLI since the Python code will rely on this to connect to FireStore
brew install java11
sudo ln -sfn /usr/local/opt/openjdk\@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.11.jdk
npm install -g firebase-tools
gcloud auth application-default login
export FIRESTORE_EMULATOR_HOST="localhost:8080"
export GCLOUD_PROJECT="any-valid-name"