A full-stack Recording Students Degrees System that record students daily revising and memorising of Quran, The store uses Flask as its backend, PostgreSQL as database, and CSS, HTML, JS/TS and Bootstrap as its Frontend.
The application is deployed on Heroku and can be accessed at
RSD-br19.herokuapp.com (currently not accessable)
Install Here: python docs
-
virtualenv as a tool to create isolated Python environments
-
It is recommended to work with a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organized.
-
Instructions for setting up a virtual environment for your platform can be found in the python docs
Once you have your virtual environment setup and running, install dependencies by running:
pip install -r requirements.tx
This will install all the required packages as mentioned within the requirements.txt
file.
-
Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.
-
Flask-CORS is the extension to use for handling cross-origin requests from our frontend server when running the project locally.
- after installing this dependency, uncomment the following line in
app/main.py
for the app to work locally:
- after installing this dependency, uncomment the following line in
# cors = CORS(app)
-
SQLite is the database for local running and
spdb.db
is the database file -
PostgreSQL is the database for production environment, because of that, you have to comment out this line of code in all of
app/main.py
:
self.conn = psycopg2.connect(DATABASE_URL, sslmode='require')
and uncomment the following line in all of app/main.py
:
# self.conn = sqlite3.connect("spdb.db")
for database connections to work locally
- Create
.env
file in the root directory and put the following values in:
USERNAME = xxxx
PASSWORD = xxxx
- From within the project directory first ensure you are working using your created virtual environment, then type the following:
flask run
or in PowerShell for Windows
$env:FLASK_APP = "app/main.py"
$env:FLASK_ENV = "development"
flask run
The API will return the following error codes and status codes
when requests fail or success:
-
200: Entity is Updated
-
201: Entity is Created
-
202: Accepted for Processing
-
204: Deleted Successfully or No Content to Return
-
400: Bad Request
-
401: Unauthorized Access
-
403: Entity Exists
-
404: Resource Not Found
-
405: Method Used Not Allowed
-
429: Rate-Limit of Requests Exceeded
-
500: Internal Server Error
-
503: Server is Down Due to Maintenance