https://rmsnigeria.pythonanywhere.com/
- Introduction
- Functionalities and Limitations
- App Structure and Implementation
- Student and Admin Guide
- Running Locally
- Contributing
- Terms and Conditions
- Resources
This website is a result of 100 days of SQL challenge I started a few weeks ago and is aimed at practicing and demonstrating the understanding of basic SQl operations. During the course of building this project, I learned how to connect to local and external databases, define tables and relationships, filter database and so on. Also, a significant amount of energy was expended on learning the required concepts, frameworks, languages, and modules. Some of these include HTML, CSS, Flask, SQLAlchemy, Bootstrap, Object Oriented Programming, Virtual Environments, and so on. Although this app has a lot of limitations, I'd say it was worth building. 🙂
This website is meant to simulate a real-world result management system whereby students can check their results using their student email and password which has been predefined by the university result management system. Admins are responsible for editing and adding new students' results along with their profile information. This site does not implement functionalities such as
- Changing admin and student passwords. Passwords are predefined.
- Validating if admin emails exist.
- Checking if students offer the specified course code and title.
This project is implemented in Python and organized as a simple package using the recommended format for 'large flask applications'.
📁rdms/
_init_.py
models.py
routes.py
database scripts
validators.py
📁static/
📁admin/
📁templates/
📁admin/
run.py
MySQL database and Xampp server was used while working on this project locally. I only used Xampp to create the database and view tables. The Python file `login_details.py` contains both student and admin login details (email and password) while `define_details.py` contains a script to add the details to the database using Flask SQLAlchemy.
You can find the website's usage guide here.
Python 3.10.6 was used at the time of building this project. For Windows users, make sure Python is added to your PATH.
Virtual environment. It is advisable to run this project inside of a virtual environment to avoid messing with your machine's primary dependencies. To get started, navigate to this project's directory, Result-Management-System-with-Python-Flask-and-MySQL
, on your local machine. Then...
Windows (cmd)
cd Result-Management-System-with-Python-Flask-and-MySQL
pip install virtualenv
python -m virtualenv venv
or
python3 -m venv venv
macOS/Linux
cd Result-Management-System-with-Python-Flask-and-MySQL
pip install virtualenv
python -m virtualenv venv
Windows (cmd)
venv\scripts\activate
macOS/Linux
. venv/bin/activate
or
source venv/bin/activate
Windows/macOS/Linux
pip install -r requirements.txt
I used Xampp server to create a base. Then used Flask-SQLAlchemy along with a MySQL database to set up connections and define tables. You can use your own local or external database. But first, you need to create the database somewhere and configure its connection to the app in __init__.py
file. For a complete list of connection URIs head over to the SQLAlchemy documentation under Supported Database. This here shows some common connection strings.
SQLAlchemy indicates the source of an Engine as a URI combined with optional keyword arguments to specify options for the Engine. The form of the URI is:
dialect+driver://username:password@host:port/database
Many of the parts in the string are optional. If no driver is specified the default one is selected (make sure to not include the + in that case).
PostgreSQL
postgresql://scott:tiger@localhost/project
MySQL / MariaDB
mysql://scott:tiger@localhost/project
SQLite (note that platform path conventions apply):
Unix/Mac (note the four leading slashes)
sqlite:////absolute/path/to/foo.db
Windows (note 3 leading forward slashes and backslash escapes)
sqlite:///C:\\absolute\\path\\to\\foo.db
Windows (alternative using raw string)
r'sqlite:///C:\absolute\path\to\foo.db'
Once you have created and connected to your database, the next step is to create all tables used in the application by running the code below
>>> from rdms import db
>>> db.create_all()
Login details. The login details for admins and students is not added automatically. To use your own custom login details, edit the emails and passwords in define_details.py
. Lastly, to add the details to the database, edit the database connection in login_details.py
then run the file.
Windows/macOS/Linux
Make sure you are in this project's root directory then run the command below
python run.py
Submit a pull request if you suspect a bug or would like to add to the functionalities of this project.
- As an admin, I will not mess up or populate the database with messy data. 😶
- I will use descriptive course codes and title.