Setting up web applications with Flask and Flask-RESTful

In this section, we will talk about the basics of developing web applications using Flask and Flask-RESTful.

Your first Flask application

As we discussed earlier, Flask is simple and straightforward. There are no complex rules or steps for developing web applications in Flask.

Perform the following steps to create your first web application using Flask:

  1. Create a module and name it FlaskWebApp.py.
  2. Edit FlaskWebApp.py and add the following code:
    from flask import Flask
    webapp = Flask(__name__)
    
    @webapp.route("/")
    def hello():
        return " Hello World!"
    
    if __name__ == '__main__':
        webapp.run(host='0.0.0.0',port=8999,debug=True)
  3. Next, open your console or command prompt and execute py FlaskWebApp.py. You ...

Get Building Web Applications with Python and Neo4j now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.