-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoteachingassistanterror.py
36 lines (35 loc) · 1.96 KB
/
autoteachingassistanterror.py
1
2
3
4
5
6
7
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
import os
from mainpath import mainpath
def create_teaching_assistant_error_page(hw_num):
final_html = f"""
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/328/328201.png" type="image/x-icon"/>
<title>MESSAGE</title>
<style type="text/css">
html{{width: 100%;height: 100%;overflow: hidden;font-style: sans-s}}
body{{width: 100%;height: 100%;font-family: 'Open Sans',sans-serif;margin: 0; background-color: #37464a; background:url("/img/homepage_background.jpg");background-size: cover;background-attachment: fixed;background-position: center;}}
#login{{position: fixed;top: 50%;left:50%;transform: translate(-50%,-50%);background:#2329358e;text-align: center;border-radius: 40px;padding: 30px;}}
#login h1{{color: #fff;text-shadow:0 0 10px;letter-spacing: 5px;text-align: center; white-space:nowrap}}
.but{{width: 310px;min-height: 20px;display: block;background-color: #07070785;border: 2px solid #bccdf3;color: #fff;padding: 12px 20px;font-size: 16px;line-height: normal;border-radius: 10px;cursor: pointer; font-family: consolas;}}
.but:hover {{background-color: #fcfcfc85;color: rgb(2, 0, 0);}}
</style>
</head>
<body>
<div id="login">
<!-- <h1>發生錯誤</h1> -->
<h1>{{{{ message }}}}</h1> <!-- 區塊段落 -->
<form action="/teachingassistant/{hw_num}">
<button class="but">返回助教頁面</button>
</form>
</div>
</body>
</html>
"""
final_html = final_html.replace("'", "\"")
os.chdir(mainpath)
with open(f"templates/teachingassistanterror.html", "w", encoding="utf-8") as file:
file.write(final_html)
os.chdir(mainpath)