![]() Inside the “templates” folder, create a file and name it “add.html,” then add the code below. Inside the “templates” folder, create a file and name it “home.html,” then add the below code. #for flashed messages to work, you have to add a secret key #deletes the data on the basis of unique id andįlash('data successfully deleted', 'danger') Queryset=Database(first_name=first, last_name=last, age=age)įlash('data successfully added', 'success')įlash('pls input data in the required fields', 'warning') ![]() If first != '' and last != '' and email != '' and age is not None: Return render_template('home.html', dashboard=dashboard) ![]() Last_name = db.Column(db.String(100), unique=True, nullable=False)Įmail = db.Column(db.String(300), unique=True) Id= db.Column(db.Integer(), primary_key=True)įirst_name = db.Column(db.String(100), unique=False, nullable=False) app.py from flask import Flask, request, render_template, url_for, redirect, flashĪpp.config= 'sqlite:///database.db'Īpp.config=False SQLAlchemy is an Object Relational Mapper (ORM).įlask-SQLAlchemy is fun to use, incredibly easy for basic applications, and readily extends for larger applications.įor the complete guide, check out the API documentation on the SQLAlchemyįirst, run the commands below to install the required dependencies: pip install pipenvĬreate a file and name it app.py. Flask is a simple yet powerful web framework that is designed to help us get started quickly and easily, with the ability to scale up to complex applications.įlask is called “micro” because it was built with a simple but extensible core. Flask is a framework that is widely used to create APIs in Python. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |