Part 2 of Build a CRUD Web App with Flask Python Framework

flask python framework logo
Standard

Haven’t yet read the 1st part of the tutorial? Visit: http://tutorialsfordevs.com/tutorials/build-a-crud-web-app-with-flask-python-framework/

Looking for a remote / home based job? Visit http://digitalnomadgigs.com/


In the first part of the tutorial, we defined a Note model:

class Note(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(80))
    body = db.Column(db.Text)
    def __init__(self, title, body):
        self.title = title
        self.body = body

Jaapz told me that we don’t have to use a custom __init__ method when creating SQLAlchemy models: https://www.reddit.com/r/flask/comments/4bgisp/how_to_build_a_crud_application_using_flask/d18ygml

Continue reading

Build a CRUD Web App with Flask Python Framework

flask python framework logo
Standard

Share this tutorial w/ your followers on Twitter. Click this link to tweet this tutorial: https://goo.gl/MtIA1L

The application that we will build is a very simple database driven note taking application. This tutorial is for beginners who want to learn how to use Flask for developing websites or web applications.

This tutorial assumes that you already installed Python and SQlite. If Python and SQlite is not yet installed in your computer, install them first. If the Python version that you installed is 2.5 and up, then you don’t need to install SQlite since Python 2.5 and up already comes with SQlite.

Python: https://www.python.org/

SQlite: https://www.sqlite.org/download.html

Things that we will cover in this tutorial:

  • Using templates
  • Saving a record in the database
  • Fetching a record in the database
  • Updating a record in the database
  • Deleting a record in the database

App requirements:

  • The user should be able to create a note (a note can have a title and a body)
  • The user should be able to view a list of notes
  • The user should be able to edit a note
  • The user should be able to delete a note

Continue reading