Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FIB API 2.0 - Flask example

Install

Requirements python 2.7 or python 3.5.

pip install -r requirements.txt

Configuration

  • Copy config.py.sample to config.py: cp config.py.sample config.py
  • Create Raco API Application here, with redirect url http://localhost:5001/login/authorized (or whatever url your server is running in)
  • Replace client secret and client id in config.py

Optionally you can set environment variables instead. You would need the folling environment variables defined:

  • secret_key: Web server random secret key.
  • consumer_key: Your app client_key.
  • consumer_secret: Your app client_secret.

Production

  • Set DEBUG to False in config.py
  • Create a random secret key.
    • Optional: You can create a random key by using the following python code
import os
os.urandom(24)

Deployment

You can easily start the server with python app.py.

In production, you should use something like Gunicorn to serve this. You can run the app with gunicorn -b :<PORT> -w <number of workers> wsgi.

Heroku

Deploy

With the above button you can deploy straight to Heroku. When deploying you will need to set the secret key, consumer key and consumer secret, as described above in the configuration section. Make sure that the redirect url for your API application points to ỳour-herokuapp-name.herokuapp.com (replacing your-herokuapp-name with whatever is your Heroku application name).


Made with <3 in Barcelona

About

An example of an application using Flask and OAuth on FIB API.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages