Creating app.py
Once the installation is done create a file name app.py and open it in your favorite editor. To check whether Flask has been properly installed you can run the following code.
from flask import Flask
app = Flask(__name__)
'''If everything works fine you will get a
message that Flask is working on the first
page of the application
'''
@app.route('/')
def check():
return 'Flask is working'
if __name__ == '__main__':
app.run()
Output:
Flask and Sqlalchemy Tutorial for Database
Flask is a micro web framework written in python. Micro-framework is normally a framework with little to no dependencies on external libraries. Though being a micro framework almost everything can be implemented using python libraries and other dependencies when and as required.
Table of Content
- Installing Flask
- Creating app.py
- Setting Up SQLAlchemy
- Creating Models
- Creating the database
- Making Migrations in database
- Creating the Index Page Of the Application
- Creating HTML page for form
- Function to add data using the form to the database
- Display data on Index Page
- Deleting data from our database
In this article, we will be building a Flask application that takes data in a form from the user and then displays it on another page on the website. We can also delete the data. We won’t focus on the front-end part rather we will be just coding the backend for the web application.