Skip to content

patraanjan23/dschit-website-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSC Website Backend

Welcome to the backend for official DSC HIT website.

This is a Python 3 and Flask based REST API which uses Firebase for datastore.

Documentation

There are 2 steps to deploy.

  1. Setup Firebase
  2. Deploy on Heroku

Setup Firebase

  1. Create a Firebase project & generate keys for a Firebase Service Account.
  2. Save the credential file as key.json in your project root.
    IMPORTANT Don't forget to add key.json to your .gitignore file so you don't accidentally commit it.
  3. Export the key.json contents through an environment variable depending on your development platform. For Linux I use direnv with a .envrc file which looks something like the following
...
export FIREBASE_CERT=$(cat key.json)
...

Deploy on Heroku

  1. Setup Heroku on local machine.
  2. Setup Heroku config variables. These variables can be accessed using the Pyhton os.environ variable. For this project, create a config variable named FIREBASE_CERT and paste the contents of the key.json file as value.
  3. If you have used Heroku dashboard to create the app then you need to setup git remote for Heroku.
  4. Finally, push the code to heroku remote and it will be deployed automatically.

Testing Locally

  1. Create a virtual environment in project root
python3 -m venv venv
  1. Activate the venv
source ./venv/bin/activate
  1. Install the dependencies using pip
pip install -r requirements.txt
  1. [OPTIONAL] Export the environment variable FLASK_ENV
# this line may also be added in .envrc file
export FLASK_ENV=development
  1. Run flask app
flask run

About

Flask backend for DSC-HIT Website

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages