Flask-rest Api with sqlalchemy database

SQLalchemy:— pip install flask-sqlalchemy

context_app:—you want to use more than one application or create the application dynamically in a function .(If you try to perform database operations outside an application context, you will see the following error:
No application found. Either work inside a view function or push an application context.
We solve it using : context_app using
)

App.py:—

Security.py :—

User.py:—-

Output:—- open terminal:–
From app import db
db. create_all()
(Database creates, “data.sqlite )
Run : app.py

Open postman :— (create two puppy name using post)
http://127.0.0.1:5500/puppy/shammy—-post(method)

http://127.0.0.1:5500/puppy/frankie—-post

(We want to see all the list of our puppies)
http://127.0.0.1:5500/puppies—-get

(Here we want to delete shammy)
http://127.0.0.1:5500/puppy/shammy—-Delete

Open chat