Hosting a Flask App on Heroku

Following the steps here –> https://realpython.com/flask-by-example-part-1-project-setup/

I managed to deploy my python flask app in Heroku.

from flask import Flask
app = Flask(__name__)


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


@app.route('/<name>')
def hello_name(name):
    return "Hello {}!".format(name)

if __name__ == '__main__':
    app.run()

You may visit the following link –>https://jirong-stage.herokuapp.com/ & add a suffix to it.

Example https://jirong-stage.herokuapp.com/jirong & this will return Hello jirong!

Possibilites are immense! I can easily create APIs or host dashboard here. Pretty exciting to me:)

Related

comments powered by Disqus