Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-362
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-362
2023-362
Commits
809ec1d5
Commit
809ec1d5
authored
Oct 23, 2023
by
Nirmal M.D.S
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created getTask.py
parent
c7733665
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
IT20074340/TaskAllocation/Sachintha/model/getTask.py
IT20074340/TaskAllocation/Sachintha/model/getTask.py
+40
-0
No files found.
IT20074340/TaskAllocation/Sachintha/model/getTask.py
0 → 100644
View file @
809ec1d5
from
flask
import
Flask
,
render_template
import
mysql.connector
app
=
Flask
(
__name__
)
# Define your MySQL database connection parameters
db_config
=
{
'host'
:
'localhost'
,
'user'
:
'root'
,
'password'
:
''
,
'database'
:
'rptestdb'
,
}
# Define a function to fetch data from the database
def
get_assigned_tasks
():
conn
=
mysql
.
connector
.
connect
(
**
db_config
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
'SELECT * FROM assignedtask'
)
tasks
=
cursor
.
fetchall
()
conn
.
close
()
return
tasks
@
app
.
route
(
'/'
)
def
index
():
tasks
=
get_assigned_tasks
()
# Print the data to the console
for
task
in
tasks
:
print
(
"Task:"
,
task
)
# Print each task
print
(
"Number of tasks:"
,
len
(
tasks
))
# Print the number of tasks
return
render_template
(
'assigntask.html'
,
tasks
=
tasks
)
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment