An E-Commerce Website using Flask(Python) Backend
__init__.py
: The main python program to be run in order to run the server(Flask App). This program takes Port Number as a command line argument.- dbaccess.py : Python code with all the utitlity functions for accessing the SQL database. Uses python's inbuilt library sqlite3 as SQL database connector. This file has been imported as
import dbaccess
inside init.py and all the utility functions are used thereby. - templates : This folder contains all the Jinja2 templates to be rendered through the Flask App.
- static : This folder contains the static files i.e. CSS, JavaScript, Images, etc.
- Python (version 3.0 or above)
- Flask : Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions.
First set the environment variable by running the following command (once for a terminal session):
- On Linux/MacOS
$ export FLASK_APP=OnlineShop
- On Windows
$ set FLASK_APP=OnlineShop
To run the server execute the following command, each time:
$ flask run
(make sure you have installed Flask, in order to run the server.)
Now the server is running at http://localhost:5000