Flask Framework

All

Intro

I’m a Django guy, well, at least a bit. More python than Django, as some people say. But recently I started to play with Flask[1], quite simple and very appropriate for building small reliable api’s.

Flask

Several tutorials online can be found, the one I really like is this [2], Miguel Grinberg is quite didatict and explains the practical part very well.

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

Example

I did an small example with Flask and Google API connection and it’s on my git.

 

Tips

1. For releasing the API not in localhost, please change the last line:

app.run(debug) --> app.run(host='0.0.0.0')

2. Use POSTMAN to do the tests and export the tests as collections

3. You can use a AWS or Google Cloud/Azure for the tests. Google is pretty nice actually, AWS too.

4. Be patience cause it might happen a little delay on the deployment in the instances.

REFs

[1] http://flask.pocoo.org

[2] https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

[3] https://github.com/FranciscoMeloJr/Python-Tests

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s