A web-based Time Table Generator application built with a Flask backend, MySQL database, and a clean, responsive HTML/CSS/JavaScript frontend. It includes roles for Admins (to generate/manage schedules), Faculty, and Students (to view their schedules).
Before running the application, make sure you have the following installed on your system:
- Python 3.8+ (Python 3.11+ is recommended)
- MySQL Server (e.g., MySQL Community Server, or via XAMPP / WampServer)
- A Web Browser (Chrome, Edge, Firefox, etc.)
Important
The database connection parameters are configured in two places:
- Backend Server: app.py uses a hardcoded dictionary named
DB_CONFIGat the top of the file (lines 6-11):DB_CONFIG = { 'host': 'localhost', 'user': 'root', 'password': '*************', # Change this to your MySQL password 'database': 'time_table' }
- Database Setup Script: setup_db.py loads settings from the .env file:
MYSQL_HOST=localhost MYSQL_USER=root MYSQL_PASSWORD=************** MYSQL_DB=timetable_generator
Ensure your MySQL server's root password matches Kaladhar*011, or update both the app.py DB_CONFIG password and .env files with your correct credentials before running setup/app scripts.
Follow these steps to set up and run the application:
It is recommended to run the app inside a virtual environment.
- Using Windows Command Prompt (cmd):
python -m venv .venv .venv\Scripts\activate
- Using Windows PowerShell:
python -m venv .venv .\.venv\Scripts\Activate.ps1
Install the required packages listed in requirements.txt:
pip install -r requirements.txtMake sure your local MySQL server is running. Then execute the setup script. This script will automatically connect to MySQL, create the time_table database, generate the tables, and populate seed data:
python setup_db.py(Verify that the console outputs: Database setup successfully completed!)
Run the Flask server:
python app.pyThe application will start, and the console will output:
🚀 Timetable Generator Server Started!
...
http://localhost:5000/
Navigate to http://localhost:5000/ (or http://localhost:5000/login.html) to access the application.
The database initialization inserts default user credentials for testing. You can use these accounts to log in:
| Role | Username | Password | Notes |
|---|---|---|---|
| Admin | admin |
adminpass |
Full control to view and save schedules |
| Faculty | faculty1 |
fpass1 |
Log in as Dr. Ram Kumar to view schedule |
| Student (Section A) | cse1 |
pass1 |
Log in to view CSE-A student schedule |
| Student (Section B) | cse2 |
pass2 |
Log in to view CSE-B student schedule |
| Student (Section C) | cse3 |
pass3 |
Log in to view CSE-C student schedule |
| Student (Section D) | cse4 |
pass4 |
Log in to view CSE-D student schedule |
Here is a summary of the key files in the repository:
- 📄 app.py: The main Flask backend code providing routing, API endpoints (auth, timetable generation, department details, saving/loading timetable slots), and serves the frontend files.
- 📄 setup_db.py: Python utility script to automate MySQL database creation, schema parsing, and seed insertion.
- 📄 schema.sql: Contains the SQL statements to initialize tables (users, departments, programs, classes, students, faculty, subjects, rooms, timetable_slots) and load sample seed data.
- 📁 static/: Contains static frontend web pages and assets:
login.html: Portal entry page.AdminDashboard.html: Interface for admin features (scheduling, sections).FacultyDashboard.html: Faculty schedule view.StudentDashboard.html: Student schedule view.script.js/styles.css: Visual styling and API call bindings.