Kshitij2604 commited on
Commit
54547af
·
verified ·
1 Parent(s): 1860b85

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +172 -184
  2. app.py +26 -59
  3. 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: 5.22.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- # Project Management System
13
-
14
- A web-based project management system for managing student projects across different domains.
15
-
16
- ## Features
17
-
18
- - User Authentication (Student/Faculty)
19
- - Project Management
20
- - Domain-based Project Organization
21
- - Student Project Assignment
22
- - Admin Panel
23
- - Responsive Design
24
-
25
- ## Deployment on Hugging Face Spaces
26
-
27
- 1. Fork this repository
28
- 2. Create a new Space on Hugging Face
29
- 3. Connect your forked repository to the Space
30
- 4. Configure the following environment variables in your Space settings:
31
- ```
32
- DB_HOST=your_database_host
33
- DB_USER=your_database_username
34
- DB_PASSWORD=your_database_password
35
- DB_NAME=your_database_name
36
- ```
37
-
38
- ## Local Development
39
-
40
- 1. Clone the repository
41
- 2. Install Python dependencies:
42
- ```bash
43
- pip install -r requirements.txt
44
- ```
45
- 3. Set up your environment variables in a `.env` file:
46
- ```
47
- DB_HOST=localhost
48
- DB_USER=root
49
- DB_PASSWORD=your_password
50
- DB_NAME=dms
51
- ```
52
- 4. Run the application:
53
- ```bash
54
- python app.py
55
- ```
56
-
57
- ## Database Setup
58
-
59
- 1. Create a MySQL database named 'dms'
60
- 2. Import the database schema from `dms.sql`
61
- 3. Run `create_domain_descriptions.php` to set up domain descriptions
62
-
63
- ## Directory Structure
64
-
65
- ```
66
- ├── app.py # Flask application
67
- ├── requirements.txt # Python dependencies
68
- ├── index.php # Homepage
69
- ├── domains.php # Domain listing
70
- ├── project_*.php # Project management files
71
- ├── admin.php # Admin panel
72
- ├── css/ # Stylesheets
73
- ├── js/ # JavaScript files
74
- ├── includes/ # PHP includes
75
- └── ajax/ # AJAX handlers
76
- ```
77
-
78
- ## Security Considerations
79
-
80
- - All user inputs are sanitized
81
- - Passwords are hashed using secure methods
82
- - Session management is implemented
83
- - Access control is enforced based on user roles
84
-
85
- ## Contributing
86
-
87
- 1. Fork the repository
88
- 2. Create a feature branch
89
- 3. Commit your changes
90
- 4. Push to the branch
91
- 5. Create a Pull Request
92
-
93
- ## License
94
-
95
- This project is licensed under the MIT License - see the LICENSE file for details.
96
-
97
- # Domain Management System
98
-
99
- A web-based platform to explore, search, and view projects across various domains, based on the DMS database.
100
-
101
- ## Features
102
-
103
- - **Browse Domains**: View all available domains in the system and their associated projects.
104
- - **Project Search**: Search for projects by name, description, domain, or type (Hardware/Software).
105
- - **Project Details**: View detailed information about each project, including descriptions, contact information, and associated resources.
106
- - **Student Information**: If the student table exists, search and view student information related to projects.
107
- - **Dynamic Data Fetching**: The system automatically fetches data from parent tables, avoiding manual duplication of data.
108
- - **Domain Descriptions**: Domain descriptions are automatically generated from the database or fallback to defaults.
109
-
110
- ## Setup Instructions
111
-
112
- ### Prerequisites
113
-
114
- - Web server with PHP support (e.g., Apache, Nginx)
115
- - MySQL/MariaDB database server
116
- - PHP 7.0 or higher
117
-
118
- ### Database Setup
119
-
120
- 1. Create a new database named `dms` in your MySQL server:
121
- ```sql
122
- CREATE DATABASE dms;
123
- ```
124
-
125
- 2. Import the SQL file (`dms (2).sql`) into your database:
126
- - Using phpMyAdmin: Go to the Import tab, select the SQL file, and click "Go"
127
- - Using MySQL command line:
128
- ```
129
- mysql -u username -p dms < "dms (2).sql"
130
- ```
131
-
132
- 3. (Optional) Create domain descriptions table:
133
- - Access the `create_domain_descriptions.php` script in your browser to create and populate the domain_descriptions table
134
- - This step is optional but recommended for better organization of domain metadata
135
-
136
- ### Web Application Setup
137
-
138
- 1. Copy all files to your web server's document root (or a subdirectory).
139
- 2. Update the database connection details in `includes/db_connect.php` if needed.
140
- 3. Make sure your web server has permissions to read/write to the files.
141
- 4. Access the website through your web browser.
142
-
143
- ## Database Structure
144
-
145
- The database consists of multiple tables:
146
-
147
- - `domain_1` through `domain_12`: Tables containing projects from different domains
148
- - `students_info`: Table containing student information (if available)
149
- - `domain_descriptions`: Optional table for storing domain descriptions
150
-
151
- Each domain table has a similar structure with fields like:
152
- - `Domain_ID`
153
- - `Project_ID`
154
- - `Project_Name`/`Project _Name`
155
- - `Email`
156
- - `H/S` (Hardware/Software)
157
- - `Description`
158
- - `Links`
159
-
160
- ## Dynamic Data Handling
161
-
162
- The system uses several utility functions to automatically fetch and process data:
163
-
164
- - **Domain Descriptions**: Automatically fetched from the domain_descriptions table if it exists, otherwise falls back to default values
165
- - **Project Names**: The system handles different column naming conventions across tables
166
- - **Cross-Domain Search**: Searches can be performed across all domain tables simultaneously
167
- - **Student-Project Association**: Student data is linked dynamically to projects for comprehensive viewing
168
-
169
- ## Usage
170
-
171
- 1. **Home Page**: View basic statistics and recent projects from all domains
172
- 2. **Domains Page**: Browse all domains and access their projects
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
- from flask import Flask, send_from_directory, abort, Response
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)}", 500
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
- @app.route('/ajax/<path:filename>')
56
- def serve_ajax(filename):
57
  try:
58
- return send_from_directory('ajax', filename)
59
- except FileNotFoundError:
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)}", 500
78
-
79
- @app.errorhandler(404)
80
- def not_found(e):
81
- return "File not found", 404
82
-
83
- @app.errorhandler(500)
84
- def server_error(e):
85
- return "Internal server error", 500
86
-
87
- if __name__ == '__main__':
88
- port = int(os.environ.get('PORT', 7860))
89
- app.run(host='0.0.0.0', port=port)
 
 
 
 
 
 
 
 
 
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
- Flask==2.0.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