E-commerce website using Flask and SQLAlchemy

E-commerce website:

This is a simple e-commerce website created using Flask and SQLAlchemy, a Python web framework and an ORM, respectively. The website displays a list of products and allows the user to add new products. The Product class is a model that represents the products in the website and it's defined using SQLAlchemy's ORM. The index() function is a route that handles the homepage of the website and it queries the database for all products and passes them to the template for rendering. The add() function is a route that handles adding new products to the website, it gets the product information from the user's request and creates a new Product instance, adds it to the session and commits the changes to the database.

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.