Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +172 -184
- app.py +26 -59
- requirements.txt +1 -3
README.md
CHANGED
|
@@ -1,184 +1,172 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Project Management System
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
#
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
#
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
#
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
-
|
| 104 |
-
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
-
|
| 115 |
-
- MySQL
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
``
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
-
|
| 153 |
-
-
|
| 154 |
-
-
|
| 155 |
-
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
-
|
| 167 |
-
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
3. **Projects Page**: Search for projects across all domains with advanced filtering
|
| 174 |
-
4. **Students Page**: Search for students by name, division, or domain (if the table exists)
|
| 175 |
-
|
| 176 |
-
## Troubleshooting
|
| 177 |
-
|
| 178 |
-
- If you encounter database connection errors, verify that the credentials in `includes/db_connect.php` are correct.
|
| 179 |
-
- Make sure that the `dms` database has been properly imported with all required tables.
|
| 180 |
-
- Check your PHP error logs if you're experiencing issues with the website.
|
| 181 |
-
|
| 182 |
-
## Credits
|
| 183 |
-
|
| 184 |
-
Created as a Database Management System project.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Project Management System
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "3.50.2"
|
| 8 |
+
|
| 9 |
+
app_file: app.py
|
| 10 |
+
pinned: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Project Management System
|
| 14 |
+
|
| 15 |
+
A web-based project management system for managing student projects across different domains.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- User Authentication (Student/Faculty)
|
| 20 |
+
- Project Management
|
| 21 |
+
- Domain-based Project Organization
|
| 22 |
+
- Student Project Assignment
|
| 23 |
+
- Admin Panel
|
| 24 |
+
- Responsive Design
|
| 25 |
+
|
| 26 |
+
## Local Development
|
| 27 |
+
|
| 28 |
+
1. Clone the repository
|
| 29 |
+
2. Install Python dependencies:
|
| 30 |
+
```bash
|
| 31 |
+
pip install -r requirements.txt
|
| 32 |
+
```
|
| 33 |
+
3. Set up your environment variables in a `.env` file:
|
| 34 |
+
```
|
| 35 |
+
DB_HOST=localhost
|
| 36 |
+
DB_USER=root
|
| 37 |
+
DB_PASSWORD=your_password
|
| 38 |
+
DB_NAME=dms
|
| 39 |
+
```
|
| 40 |
+
4. Run the application:
|
| 41 |
+
```bash
|
| 42 |
+
python app.py
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Database Setup
|
| 46 |
+
|
| 47 |
+
1. Create a MySQL database named 'dms'
|
| 48 |
+
2. Import the database schema from `dms.sql`
|
| 49 |
+
3. Run `create_domain_descriptions.php` to set up domain descriptions
|
| 50 |
+
|
| 51 |
+
## Directory Structure
|
| 52 |
+
|
| 53 |
+
```
|
| 54 |
+
├── app.py # Gradio application
|
| 55 |
+
├── requirements.txt # Python dependencies
|
| 56 |
+
├── index.php # Homepage
|
| 57 |
+
├── domains.php # Domain listing
|
| 58 |
+
├── project_*.php # Project management files
|
| 59 |
+
├── admin.php # Admin panel
|
| 60 |
+
├── css/ # Stylesheets
|
| 61 |
+
├── js/ # JavaScript files
|
| 62 |
+
├── includes/ # PHP includes
|
| 63 |
+
└── ajax/ # AJAX handlers
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Security Considerations
|
| 67 |
+
|
| 68 |
+
- All user inputs are sanitized
|
| 69 |
+
- Passwords are hashed using secure methods
|
| 70 |
+
- Session management is implemented
|
| 71 |
+
- Access control is enforced based on user roles
|
| 72 |
+
|
| 73 |
+
## Contributing
|
| 74 |
+
|
| 75 |
+
1. Fork the repository
|
| 76 |
+
2. Create a feature branch
|
| 77 |
+
3. Commit your changes
|
| 78 |
+
4. Push to the branch
|
| 79 |
+
5. Create a Pull Request
|
| 80 |
+
|
| 81 |
+
## License
|
| 82 |
+
|
| 83 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
| 84 |
+
|
| 85 |
+
# Domain Management System
|
| 86 |
+
|
| 87 |
+
A web-based platform to explore, search, and view projects across various domains, based on the DMS database.
|
| 88 |
+
|
| 89 |
+
## Features
|
| 90 |
+
|
| 91 |
+
- **Browse Domains**: View all available domains in the system and their associated projects.
|
| 92 |
+
- **Project Search**: Search for projects by name, description, domain, or type (Hardware/Software).
|
| 93 |
+
- **Project Details**: View detailed information about each project, including descriptions, contact information, and associated resources.
|
| 94 |
+
- **Student Information**: If the student table exists, search and view student information related to projects.
|
| 95 |
+
- **Dynamic Data Fetching**: The system automatically fetches data from parent tables, avoiding manual duplication of data.
|
| 96 |
+
- **Domain Descriptions**: Domain descriptions are automatically generated from the database or fallback to defaults.
|
| 97 |
+
|
| 98 |
+
## Setup Instructions
|
| 99 |
+
|
| 100 |
+
### Prerequisites
|
| 101 |
+
|
| 102 |
+
- Web server with PHP support (e.g., Apache, Nginx)
|
| 103 |
+
- MySQL/MariaDB database server
|
| 104 |
+
- PHP 7.0 or higher
|
| 105 |
+
|
| 106 |
+
### Database Setup
|
| 107 |
+
|
| 108 |
+
1. Create a new database named `dms` in your MySQL server:
|
| 109 |
+
```sql
|
| 110 |
+
CREATE DATABASE dms;
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
2. Import the SQL file (`dms (2).sql`) into your database:
|
| 114 |
+
- Using phpMyAdmin: Go to the Import tab, select the SQL file, and click "Go"
|
| 115 |
+
- Using MySQL command line:
|
| 116 |
+
```
|
| 117 |
+
mysql -u username -p dms < "dms (2).sql"
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
3. (Optional) Create domain descriptions table:
|
| 121 |
+
- Access the `create_domain_descriptions.php` script in your browser to create and populate the domain_descriptions table
|
| 122 |
+
- This step is optional but recommended for better organization of domain metadata
|
| 123 |
+
|
| 124 |
+
### Web Application Setup
|
| 125 |
+
|
| 126 |
+
1. Copy all files to your web server's document root (or a subdirectory).
|
| 127 |
+
2. Update the database connection details in `includes/db_connect.php` if needed.
|
| 128 |
+
3. Make sure your web server has permissions to read/write to the files.
|
| 129 |
+
4. Access the website through your web browser.
|
| 130 |
+
|
| 131 |
+
## Database Structure
|
| 132 |
+
|
| 133 |
+
The database consists of multiple tables:
|
| 134 |
+
|
| 135 |
+
- `domain_1` through `domain_12`: Tables containing projects from different domains
|
| 136 |
+
- `students_info`: Table containing student information (if available)
|
| 137 |
+
- `domain_descriptions`: Optional table for storing domain descriptions
|
| 138 |
+
|
| 139 |
+
Each domain table has a similar structure with fields like:
|
| 140 |
+
- `Domain_ID`
|
| 141 |
+
- `Project_ID`
|
| 142 |
+
- `Project_Name`/`Project _Name`
|
| 143 |
+
- `Email`
|
| 144 |
+
- `H/S` (Hardware/Software)
|
| 145 |
+
- `Description`
|
| 146 |
+
- `Links`
|
| 147 |
+
|
| 148 |
+
## Dynamic Data Handling
|
| 149 |
+
|
| 150 |
+
The system uses several utility functions to automatically fetch and process data:
|
| 151 |
+
|
| 152 |
+
- **Domain Descriptions**: Automatically fetched from the domain_descriptions table if it exists, otherwise falls back to default values
|
| 153 |
+
- **Project Names**: The system handles different column naming conventions across tables
|
| 154 |
+
- **Cross-Domain Search**: Searches can be performed across all domain tables simultaneously
|
| 155 |
+
- **Student-Project Association**: Student data is linked dynamically to projects for comprehensive viewing
|
| 156 |
+
|
| 157 |
+
## Usage
|
| 158 |
+
|
| 159 |
+
1. **Home Page**: View basic statistics and recent projects from all domains
|
| 160 |
+
2. **Domains Page**: Browse all domains and access their projects
|
| 161 |
+
3. **Projects Page**: Search for projects across all domains with advanced filtering
|
| 162 |
+
4. **Students Page**: Search for students by name, division, or domain (if the table exists)
|
| 163 |
+
|
| 164 |
+
## Troubleshooting
|
| 165 |
+
|
| 166 |
+
- If you encounter database connection errors, verify that the credentials in `includes/db_connect.php` are correct.
|
| 167 |
+
- Make sure that the `dms` database has been properly imported with all required tables.
|
| 168 |
+
- Check your PHP error logs if you're experiencing issues with the website.
|
| 169 |
+
|
| 170 |
+
## Credits
|
| 171 |
+
|
| 172 |
+
Created as a Database Management System project.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
-
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
import tempfile
|
| 5 |
import shutil
|
| 6 |
|
| 7 |
-
app = Flask(__name__)
|
| 8 |
-
|
| 9 |
def execute_php(php_file):
|
| 10 |
try:
|
| 11 |
# Create a temporary directory for PHP execution
|
|
@@ -28,62 +26,31 @@ def execute_php(php_file):
|
|
| 28 |
|
| 29 |
return result.stdout
|
| 30 |
except Exception as e:
|
| 31 |
-
return f"Error executing PHP: {str(e)}"
|
| 32 |
-
|
| 33 |
-
# Serve static files
|
| 34 |
-
@app.route('/css/<path:filename>')
|
| 35 |
-
def serve_css(filename):
|
| 36 |
-
try:
|
| 37 |
-
return send_from_directory('css', filename)
|
| 38 |
-
except FileNotFoundError:
|
| 39 |
-
abort(404)
|
| 40 |
-
|
| 41 |
-
@app.route('/js/<path:filename>')
|
| 42 |
-
def serve_js(filename):
|
| 43 |
-
try:
|
| 44 |
-
return send_from_directory('js', filename)
|
| 45 |
-
except FileNotFoundError:
|
| 46 |
-
abort(404)
|
| 47 |
-
|
| 48 |
-
@app.route('/includes/<path:filename>')
|
| 49 |
-
def serve_includes(filename):
|
| 50 |
-
try:
|
| 51 |
-
return send_from_directory('includes', filename)
|
| 52 |
-
except FileNotFoundError:
|
| 53 |
-
abort(404)
|
| 54 |
|
| 55 |
-
|
| 56 |
-
def serve_ajax(filename):
|
| 57 |
try:
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
abort(404)
|
| 61 |
-
|
| 62 |
-
# Serve PHP files
|
| 63 |
-
@app.route('/')
|
| 64 |
-
def serve_index():
|
| 65 |
-
try:
|
| 66 |
-
return execute_php('index.php')
|
| 67 |
-
except Exception as e:
|
| 68 |
-
return f"Error: {str(e)}", 500
|
| 69 |
-
|
| 70 |
-
@app.route('/<path:filename>')
|
| 71 |
-
def serve_php(filename):
|
| 72 |
-
try:
|
| 73 |
-
if filename.endswith('.php'):
|
| 74 |
-
return execute_php(filename)
|
| 75 |
-
abort(404)
|
| 76 |
except Exception as e:
|
| 77 |
-
return f"Error: {str(e)}"
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
import os
|
| 3 |
import subprocess
|
| 4 |
import tempfile
|
| 5 |
import shutil
|
| 6 |
|
|
|
|
|
|
|
| 7 |
def execute_php(php_file):
|
| 8 |
try:
|
| 9 |
# Create a temporary directory for PHP execution
|
|
|
|
| 26 |
|
| 27 |
return result.stdout
|
| 28 |
except Exception as e:
|
| 29 |
+
return f"Error executing PHP: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
def serve_static_file(filepath):
|
|
|
|
| 32 |
try:
|
| 33 |
+
with open(filepath, 'rb') as f:
|
| 34 |
+
return f.read()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
except Exception as e:
|
| 36 |
+
return f"Error reading file: {str(e)}"
|
| 37 |
+
|
| 38 |
+
# Create Gradio interface
|
| 39 |
+
with gr.Blocks() as demo:
|
| 40 |
+
gr.Markdown("# Project Management System")
|
| 41 |
+
|
| 42 |
+
with gr.Tab("Home"):
|
| 43 |
+
gr.Markdown(execute_php('index.php'))
|
| 44 |
+
|
| 45 |
+
with gr.Tab("Domains"):
|
| 46 |
+
gr.Markdown(execute_php('domains.php'))
|
| 47 |
+
|
| 48 |
+
with gr.Tab("Projects"):
|
| 49 |
+
gr.Markdown(execute_php('domain_projects.php'))
|
| 50 |
+
|
| 51 |
+
with gr.Tab("Admin"):
|
| 52 |
+
gr.Markdown(execute_php('admin.php'))
|
| 53 |
+
|
| 54 |
+
# Launch the interface
|
| 55 |
+
if __name__ == "__main__":
|
| 56 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
requirements.txt
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
Werkzeug==2.0.3
|
| 3 |
mysql-connector-python==8.0.26
|
| 4 |
python-dotenv==0.19.0
|
| 5 |
-
gunicorn==20.1.0
|
| 6 |
php-fpm==8.1.0
|
|
|
|
| 1 |
+
gradio==3.50.2
|
|
|
|
| 2 |
mysql-connector-python==8.0.26
|
| 3 |
python-dotenv==0.19.0
|
|
|
|
| 4 |
php-fpm==8.1.0
|