Python/Flask Tutorial
Quick launch into Flask, Variables, Functions, List, Dictionariesy, and APIs.
Hacks
Provide a Python Backend summary that is a companion to the JavaScript Tutorial. To get you rolling, the below is very minimal and would need the data example extracted to its own cell, with more complicated cells extract from things like SQLite and Pandas.
- Run Python Backend in Notebook or server
- Have an API for
- Static Data for Users example
- SQLite API that should Filtering, Sorting
- Pandas, Numpy, or 3rd Party API that you have filtered
from flask import Flask, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
# Define a static list of data
data = [{'name': 'Joe', 'age': 17}, {'name': 'Jane', 'age': 25}, {'name': 'Bob', 'age': 40}]
@app.route('/data')
def get_data():
return jsonify(data)
if __name__ == '__main__':
app.run()