Flask api
Ejemplo de api en python-flask para desplegar en heroku
Ejecutar localmente
Tener instalado localmente:
- mongodb v4.4 o superior
- python 3.6.9 o superior
$ pip3 install --user pipenv
$ git clone https://github.com/Otzoy97/ipc1-proyecto2.git
$ cd ipc1-proyecto2
$ pipenv install
$ pipenv shell
$ python app.py
La aplicación debería estar corriendo en localhost:5000
Desplegar en heroku
Tener instalado Heroku CLI y configurar la cuenta a utilizar para desplegar la aplicación. Poseer un cluster en mongoDB Atlas.
$ heroku create
$ git push heroku main
$ heroku config:set MONGO_URI=<mongo_uri>
$ heroku config:set JWT_SECRET_KEY=<secret_key>
$ heroku run python app.py
Reemplazar <mongo_uri> con la cadena de conección del cluster de mongoDB Atlas y <secret_key> con un texto que sea difícil de adivinar.
Para consumir los servicios utilizar la Web URL que provee heroku para la aplicación recién desplegada.
$ heroku info
Referencias
Flask Rest API - Zero to Yoda
Getting Started on Heroku with Python