Compare commits
2 Commits
8ab1908e27
...
python
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f0f9df727 | |||
| 690b4e2ed3 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -19,3 +19,6 @@ static/upload/*
|
|||||||
static/counter.txt
|
static/counter.txt
|
||||||
static/message/*
|
static/message/*
|
||||||
static/test/*
|
static/test/*
|
||||||
|
|
||||||
|
# config
|
||||||
|
config/**
|
||||||
@@ -9,6 +9,22 @@ import time
|
|||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# postgresql
|
||||||
|
import psycopg2
|
||||||
|
with open('/var/open-ww3-project-ww3-tw/config/blog/db_config.json', 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
# 设定数据库连接配置
|
||||||
|
conn_params = {
|
||||||
|
"dbname" : data['dbname'],
|
||||||
|
"user" : data['user'],
|
||||||
|
"password": data['password'],
|
||||||
|
"host": data['host'],
|
||||||
|
"port": data['port']
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_owp_db_conn():
|
def get_owp_db_conn():
|
||||||
conn = sqlite3.connect('/var/open-ww3-project-ww3-tw/databases/sqlite/owp.db')
|
conn = sqlite3.connect('/var/open-ww3-project-ww3-tw/databases/sqlite/owp.db')
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
@@ -42,13 +58,37 @@ def no_game(subpath=None):
|
|||||||
|
|
||||||
@blog_bp.route('/')
|
@blog_bp.route('/')
|
||||||
def home():
|
def home():
|
||||||
db = get_owp_db()
|
conn = psycopg2.connect(**conn_params)
|
||||||
conn = get_owp_db_conn()
|
cur = conn.cursor()
|
||||||
sql_logs = "SELECT * from logs;"
|
sql_logs = "SELECT * FROM logs;"
|
||||||
sql_posts = "SELECT * from posts where status= 1;"
|
sql_posts = "SELECT* FROM posts WHERE status = 1;"
|
||||||
logs = conn.execute(sql_logs).fetchall()
|
|
||||||
posts = conn.execute(sql_posts).fetchall()
|
cur.execute(sql_logs)
|
||||||
|
cur_logs = cur.fetchall()
|
||||||
|
cur.execute(sql_posts)
|
||||||
|
cur_posts = cur.fetchall()
|
||||||
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
# 格式转换
|
||||||
|
dict_logs = [
|
||||||
|
{
|
||||||
|
"id": row[0],
|
||||||
|
"date": row[1],
|
||||||
|
"content": row[2]
|
||||||
|
} for row in cur_logs
|
||||||
|
]
|
||||||
|
dict_posts = [
|
||||||
|
{
|
||||||
|
"id": row[0],
|
||||||
|
"date": row[1],
|
||||||
|
"title": row[2],
|
||||||
|
"content": row[3]
|
||||||
|
} for row in cur_posts
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# 计数器
|
||||||
count_file = '/var/open-ww3-project-ww3-tw/static/counter.txt'
|
count_file = '/var/open-ww3-project-ww3-tw/static/counter.txt'
|
||||||
def load_couter():
|
def load_couter():
|
||||||
if os.path.exists(count_file):
|
if os.path.exists(count_file):
|
||||||
@@ -61,7 +101,8 @@ def home():
|
|||||||
counter = load_couter()
|
counter = load_couter()
|
||||||
counter += 1
|
counter += 1
|
||||||
save_couter(counter)
|
save_couter(counter)
|
||||||
return render_template('blog/home.html', logs=logs[::-1], posts=posts[::-1], counter=counter)
|
|
||||||
|
return render_template('blog/home.html', counter = counter, logs = dict_logs[::-1], posts = dict_posts[::-1])
|
||||||
|
|
||||||
@blog_bp.route('/about/')
|
@blog_bp.route('/about/')
|
||||||
def about():
|
def about():
|
||||||
@@ -70,14 +111,27 @@ def about():
|
|||||||
|
|
||||||
@blog_bp.route('/posts/')
|
@blog_bp.route('/posts/')
|
||||||
def posts_list():
|
def posts_list():
|
||||||
conn = get_owp_db_conn()
|
conn = psycopg2.connect(**conn_params)
|
||||||
sql_posts = "SELECT * from posts where status= 1;"
|
sql_posts = "SELECT * from posts where status= 1;"
|
||||||
posts = conn.execute(sql_posts).fetchall()
|
cur = conn.cursor()
|
||||||
|
cur.execute(sql_posts)
|
||||||
|
cur_posts = cur.fetchall()
|
||||||
conn.close()
|
conn.close()
|
||||||
return render_template('blog/list.html', posts=posts[::-1])
|
|
||||||
|
|
||||||
|
dict_posts = [
|
||||||
|
{
|
||||||
|
"id": row[0],
|
||||||
|
"date": row[1],
|
||||||
|
"title": row[2],
|
||||||
|
"content": row[3]
|
||||||
|
} for row in cur_posts
|
||||||
|
]
|
||||||
|
return render_template('blog/list.html', posts = dict_posts[::-1])
|
||||||
|
|
||||||
|
# 迁移中
|
||||||
@blog_bp.route('/posts/<int:posts_id>/')
|
@blog_bp.route('/posts/<int:posts_id>/')
|
||||||
def show_posts_id(posts_id):
|
def show_posts_id(posts_id):
|
||||||
|
# json
|
||||||
message_path = f"/var/open-ww3-project-ww3-tw/static/message/{posts_id}"
|
message_path = f"/var/open-ww3-project-ww3-tw/static/message/{posts_id}"
|
||||||
|
|
||||||
if not os.path.exists(message_path):
|
if not os.path.exists(message_path):
|
||||||
@@ -88,19 +142,35 @@ def show_posts_id(posts_id):
|
|||||||
json.dump([], file, ensure_ascii=False)
|
json.dump([], file, ensure_ascii=False)
|
||||||
message_ss = json.load(open(message_json, 'r', encoding='utf-8'))
|
message_ss = json.load(open(message_json, 'r', encoding='utf-8'))
|
||||||
|
|
||||||
|
conn = psycopg2.connect(**conn_params)
|
||||||
|
cur = conn.cursor()
|
||||||
|
sql_posts = f"SELECT * FROM posts WHERE status = 1 AND id = {posts_id};"
|
||||||
|
cur.execute(sql_posts)
|
||||||
|
posts = cur.fetchone()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
if posts is None:
|
||||||
|
shutil.rmtree(message_path)
|
||||||
|
return f'未找到该文章{posts_id}<title>未找到该文章{posts_id}/</title><br><a href="../">返回文章列表</a>', 404
|
||||||
|
dict_posts = [
|
||||||
|
{
|
||||||
|
"id": posts[0],
|
||||||
|
"date": posts[1],
|
||||||
|
"title": posts[2],
|
||||||
|
"content": posts[3],
|
||||||
|
"status": posts[4],
|
||||||
|
"update_time": posts[5]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
conn = get_owp_db_conn()
|
|
||||||
conn_message = get_message_db_conn()
|
conn_message = get_message_db_conn()
|
||||||
sql_posts = "SELECT * FROM posts WHERE status = 1 AND id = ?"
|
|
||||||
posts = conn.execute(sql_posts, (posts_id,)).fetchone()
|
|
||||||
sql_message = "SELECT * FROM messages WHERE posts_id = ?"
|
sql_message = "SELECT * FROM messages WHERE posts_id = ?"
|
||||||
message = conn_message.execute(sql_message, (posts_id,)).fetchall()
|
message = conn_message.execute(sql_message, (posts_id,)).fetchall()
|
||||||
conn.close()
|
conn.close()
|
||||||
conn_message.close()
|
conn_message.close()
|
||||||
if posts is None:
|
|
||||||
shutil.rmtree(message_path)
|
return render_template('blog/posts.html', posts = dict_posts, message = message[::-1], message_ss=message_ss[::-1])
|
||||||
return f'未找到该文章{posts_id}<title>未找到该文章{posts_id}/</title>', 404
|
|
||||||
return render_template('blog/posts.html', posts=posts, message=message[::-1], message_ss=message_ss[::-1])
|
|
||||||
|
|
||||||
# posts 留言
|
# posts 留言
|
||||||
@blog_bp.route('/posts/<int:posts_id>/chat/', methods=['POST', 'GET'])
|
@blog_bp.route('/posts/<int:posts_id>/chat/', methods=['POST', 'GET'])
|
||||||
|
|||||||
@@ -42,4 +42,4 @@ def paint_home():
|
|||||||
|
|
||||||
for class_data in db_cursor.execute(class_sql).fetchall():
|
for class_data in db_cursor.execute(class_sql).fetchall():
|
||||||
for tags_data in db_cursor.execute(tags_sql).fetchall():
|
for tags_data in db_cursor.execute(tags_sql).fetchall():
|
||||||
return render_template('paint/home.html', data = data, tags_data = tags_data[0], class_data = class_data[0], img_url = img_url)
|
return render_template('paint/home.html', data = data[::-1], tags_data = tags_data[0], class_data = class_data[0], img_url = img_url)
|
||||||
@@ -1,9 +1,24 @@
|
|||||||
from flask import Blueprint, render_template, request, url_for, flash, redirect
|
from flask import Blueprint, render_template, request, url_for, flash, redirect, session
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import psycopg2, json, hashlib
|
||||||
|
|
||||||
study_bp = Blueprint('study', __name__)
|
study_bp = Blueprint('study', __name__)
|
||||||
|
|
||||||
|
# pgdb_conn
|
||||||
|
# 读取json文件
|
||||||
|
with open('/var/open-ww3-project-ww3-tw/config/study/db_config.json', 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
print(data)
|
||||||
|
# 设定数据库连接配置
|
||||||
|
conn_params = {
|
||||||
|
"dbname" : data['dbname'],
|
||||||
|
"user" : data['user'],
|
||||||
|
"password": data['password'],
|
||||||
|
"host": data['host'],
|
||||||
|
"port": data['port']
|
||||||
|
}
|
||||||
|
|
||||||
def get_db_conn():
|
def get_db_conn():
|
||||||
conn = sqlite3.connect('/var/open-ww3-project-ww3-tw/databases/database.db')
|
conn = sqlite3.connect('/var/open-ww3-project-ww3-tw/databases/database.db')
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
@@ -94,3 +109,98 @@ def delete_posts_id(posts_id):
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
return render_template('study/delete.html', posts=posts)
|
return render_template('study/delete.html', posts=posts)
|
||||||
|
|
||||||
|
@study_bp.route('/bbs/', methods=['POST' , 'GET'])
|
||||||
|
def pgdb():
|
||||||
|
# 连接数据库
|
||||||
|
try:
|
||||||
|
conn = psycopg2.connect(**conn_params)
|
||||||
|
print("连接没问题!!!")
|
||||||
|
cur = conn.cursor()
|
||||||
|
# cur.execute("select * from study_pg;")
|
||||||
|
# db_cur = cur.fetchone()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
# return f"连接没问题!!!<br>数据库内容: {db_cur}"
|
||||||
|
return render_template("study/bbs.html")
|
||||||
|
# , db_cur = db_cur)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"出现了一点状况: {e}")
|
||||||
|
cur = conn.cursor()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
return f"出现了一点状况: {e}"
|
||||||
|
|
||||||
|
@study_bp.route('/bbs/register/', methods=['POST' , 'GET'])
|
||||||
|
def pgdb_register():
|
||||||
|
if request.method == "GET":
|
||||||
|
return render_template('study/register.html')
|
||||||
|
|
||||||
|
if request.method == "POST":
|
||||||
|
username = request.form.get('username')
|
||||||
|
passwd = request.form.get('passwd')
|
||||||
|
age = request.form.get('age')
|
||||||
|
hash_obj = hashlib.sha256()
|
||||||
|
hash_obj.update(passwd.encode())
|
||||||
|
passwd_hash = hash_obj.hexdigest()
|
||||||
|
nbsp = " " *4
|
||||||
|
|
||||||
|
# 数据库操作
|
||||||
|
conn = psycopg2.connect(**conn_params)
|
||||||
|
cur = conn.cursor()
|
||||||
|
sql_check = f"select username from user_temp where username = '{username}';"
|
||||||
|
cur.execute(sql_check)
|
||||||
|
sql_name = cur.fetchone()
|
||||||
|
# cur.close()
|
||||||
|
# conn.close()
|
||||||
|
if sql_name == None:
|
||||||
|
sql_insert = f"insert into user_temp (username, passwd, age) values ('{username}', '{passwd_hash}', '{age}');"
|
||||||
|
cur.execute(sql_insert)
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
return "名字没问题允许注册" \
|
||||||
|
"用户名: " f"{nbsp}" f"{username}" "<br>" \
|
||||||
|
"密码: " f"{nbsp}" f"{passwd}" "<br>" \
|
||||||
|
"年龄: " f"{nbsp}" "**" "<br>" "<br>" \
|
||||||
|
"<b>密码为哈希存储,只会展示一次<br>" \
|
||||||
|
"如果忘记密码了,建议重新注册</b>" \
|
||||||
|
# "<br>" "<br>" f"{sql_name}"
|
||||||
|
else:
|
||||||
|
conn.close()
|
||||||
|
return "名字大错特错!!!不允许注册<br><a href='./'>返回注册页面</a>"
|
||||||
|
# sql_insert = f"insert into user_temp (username, passwd, age) values ('{username}', '{passwd_hash}', '{age}');"
|
||||||
|
# cur.execute(sql_insert)
|
||||||
|
# conn.commit()
|
||||||
|
# cur.close()
|
||||||
|
# conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
@study_bp.route('/bbs/login/', methods=['POST', 'GET'])
|
||||||
|
def pgdb_login():
|
||||||
|
if request.method == "GET":
|
||||||
|
return render_template('study/login.html')
|
||||||
|
|
||||||
|
if request.method == "POST":
|
||||||
|
username = request.form.get('username', '')
|
||||||
|
passwd = request.form.get('passwd', '')
|
||||||
|
|
||||||
|
if not username or not passwd:
|
||||||
|
return "用户名或密码不能空<br><a href='./'>返回重登</a>"
|
||||||
|
|
||||||
|
hash_passwd = hashlib.sha256(passwd.encode()).hexdigest()
|
||||||
|
|
||||||
|
conn = psycopg2.connect(**conn_params)
|
||||||
|
cur = conn.cursor()
|
||||||
|
cur.execute(
|
||||||
|
"SELECT id, passwd FROM user_temp WHERE username = %s",
|
||||||
|
(username,)
|
||||||
|
)
|
||||||
|
row = cur.fetchone()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
if row and row[1] == hash_passwd:
|
||||||
|
session['user_id'] = row[0]
|
||||||
|
return "登录成功<br>"
|
||||||
|
else:
|
||||||
|
return "登录失败了.....<br><a href='./'>点击重新登录</a>"
|
||||||
@@ -7,4 +7,5 @@ future==1.0.0
|
|||||||
itsdangerous==2.2.0
|
itsdangerous==2.2.0
|
||||||
Jinja2==3.1.6
|
Jinja2==3.1.6
|
||||||
MarkupSafe==3.0.3
|
MarkupSafe==3.0.3
|
||||||
|
psycopg2==2.9.12
|
||||||
Werkzeug==3.1.4
|
Werkzeug==3.1.4
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ln -svf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && python3 /var/open-ww3-project-ww3-tw/main.py
|
#ln -svf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && python3 /var/open-ww3-project-ww3-tw/main.py
|
||||||
|
|
||||||
|
ln -svf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||||
|
/var/open-ww3-project-ww3-tw/venv/bin/python /var/open-ww3-project-ww3-tw/main.py
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
{% include 'blog/include/navbar.html' %}
|
{% include 'blog/include/navbar.html' %}
|
||||||
<br>
|
<br>
|
||||||
<a href="{{ url_for('blog.home') }}">返回首页</a>__<a href="{{ url_for('blog.sitemap') }}">网页地图</a>
|
<a href="{{ url_for('blog.home') }}">返回首页</a>__<a href="{{ url_for('blog.sitemap') }}">网页地图</a>
|
||||||
|
<hr id="hr_2">
|
||||||
|
数据库迁移至postgresql
|
||||||
|
<br>
|
||||||
|
<p>2026.07.11</p>
|
||||||
|
<br>
|
||||||
<hr id="hr_2">
|
<hr id="hr_2">
|
||||||
本站建立于大概2025年8月前后<br>
|
本站建立于大概2025年8月前后<br>
|
||||||
差不多是个人博客多次重建后的成果<br>
|
差不多是个人博客多次重建后的成果<br>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
{% for posts in posts %}
|
||||||
<title>{{ posts['title'] }}</title>
|
<title>{{ posts['title'] }}</title>
|
||||||
<link rel="icon" type="image/x-icon" href="/static/icon/original.ico">
|
<link rel="icon" type="image/x-icon" href="/static/icon/original.ico">
|
||||||
<meta property="og:title" content="{{ posts['title'] }}">
|
<meta property="og:title" content="{{ posts['title'] }}">
|
||||||
@@ -8,19 +8,20 @@
|
|||||||
<meta property="og:image" content="https://ww3.tw/static/img/open-ww3-project.png">
|
<meta property="og:image" content="https://ww3.tw/static/img/open-ww3-project.png">
|
||||||
<meta property="og:url" content="https://ww3.tw/blog/posts/{{ posts['id']}}/">
|
<meta property="og:url" content="https://ww3.tw/blog/posts/{{ posts['id']}}/">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
</head>
|
{% endfor %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a href="/blog">返回主页</a>
|
<a href="/blog">返回主页</a>
|
||||||
<br>
|
<br>
|
||||||
<h1>{{ posts['title'] }}</h1>
|
<h1>{{ posts['title'] }}</h1>
|
||||||
<br>
|
{% for posts in posts %}
|
||||||
<br>
|
|
||||||
{{ posts['content'].replace('&a&a','<style>a{text-decoration: none;}</style>') | safe}}
|
{{ posts['content'].replace('&a&a','<style>a{text-decoration: none;}</style>') | safe}}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
最后修改时间: 【{{ posts['update_time'].replace('.', '-') }}】
|
最后修改时间: 【{{ posts['update_time'].replace('.', '-') }}】
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<h2>留言区: </h2>
|
<h2>留言区: </h2>
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: rgb(175, 223, 255);
|
background-color: rgb(175, 223, 255);
|
||||||
|
|||||||
13
templates/paint/extension/base.html
Normal file
13
templates/paint/extension/base.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>{% block title %}{% endblock %} | ww3</title>
|
||||||
|
{% block style %}
|
||||||
|
{# 这里存放style模板的数据 #}
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block content %}
|
||||||
|
{# 这里存放写入模板的数据 #}
|
||||||
|
{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
{# 引入base #}
|
{# 引入base #}
|
||||||
{% extends 'blog/extension/base.html' %}
|
{% extends 'paint/extension/base.html' %}
|
||||||
|
|
||||||
{% include 'blog/include/head.html' %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{# 引入标题 #}
|
{# 引入标题 #}
|
||||||
{% block title %}paint{% endblock %}
|
{% block title %}paint{% endblock %}
|
||||||
|
|
||||||
|
{% include 'blog/include/head.html' %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<head>
|
{% block style %}
|
||||||
<style>
|
<style>
|
||||||
hr {
|
hr {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
@@ -22,32 +20,51 @@
|
|||||||
width: 500px;
|
width: 500px;
|
||||||
height: auto;
|
height: auto;
|
||||||
background-color: rgb(169, 198, 252);
|
background-color: rgb(169, 198, 252);
|
||||||
|
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#url_ {
|
||||||
|
margin: 0 5px 0 0;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
background-color: rgb(92, 92, 92);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
{% endblock %}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
{% include 'blog/include/navbar2.html' %}
|
{% include 'blog/include/navbar2.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<div style="height: 100%;">
|
||||||
|
<div style="background-color: #93B9FFA4;">
|
||||||
<a href="/blog/">返回主页</a>
|
<a href="/blog/">返回主页</a>
|
||||||
<h2>这里是关于本人的绘画学习及其临摹的记录和展示页面</h2>
|
<h2>这里是关于本人的绘画学习及其临摹的记录和展示页面</h2>
|
||||||
<hr>
|
<hr>
|
||||||
<a href="https://ww3.tw/blog/folders/paint/old">旧作列表</a>
|
<a href="https://ww3.tw/blog/folders/paint/old">旧作列表</a>
|
||||||
<br>
|
<br>
|
||||||
|
<br>
|
||||||
{% for data in data %}
|
{% for data in data %}
|
||||||
<br>
|
|
||||||
<img src="{{img_url}}{{data['date']}}/{{data['name']}}.jpg" alt="{{data['name']}}" width="15%">
|
<img src="{{img_url}}{{data['date']}}/{{data['name']}}.jpg" alt="{{data['name']}}" width="15%">
|
||||||
<br>
|
|
||||||
{{data['name']}}__
|
{{data['name']}}__
|
||||||
{{data['date']}}
|
{{data['date']}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
</div>
|
||||||
<!-- tags: __{{tags_data}}
|
<!-- tags: __{{tags_data}}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
class: __{{class_data}} -->
|
class: __{{class_data}} -->
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
{% include 'blog/include/footer.html' %}
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<br>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
21
templates/study/bbs.html
Normal file
21
templates/study/bbs.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>bbs</title>
|
||||||
|
<script>
|
||||||
|
// alert("数据库连接没问题!!!\n并且这是一个测试页面")
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p style="text-align: right;"><a href="./register">注册</a> | <a href="./login">登录</a></p>
|
||||||
|
<p style="font-size: 66px; transform: translate(0px, -120px); width: 25%;" >bbs</p>
|
||||||
|
<div style="transform: translate(0px, -120px);">
|
||||||
|
发送内容:
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
所有内容:
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
19
templates/study/login.html
Normal file
19
templates/study/login.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
登录页面
|
||||||
|
<br>
|
||||||
|
<form method="post" action="./">
|
||||||
|
用户名:
|
||||||
|
<br>
|
||||||
|
<input type="text" name="username" id="lower" required>
|
||||||
|
<br>
|
||||||
|
密码:
|
||||||
|
<br>
|
||||||
|
<input type="password" name="passwd" required>
|
||||||
|
<br>
|
||||||
|
<button type="submit">登录</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('lower').addEventListener('input', function() {
|
||||||
|
this.value = this.value.toLowerCase();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
23
templates/study/register.html
Normal file
23
templates/study/register.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
在这里可以注册为临时用户用于管理您所发布过的文章和回复
|
||||||
|
<form method="post" action="./">
|
||||||
|
<br>
|
||||||
|
用户名
|
||||||
|
<br>
|
||||||
|
<input type="text" name="username" id="lower" required>
|
||||||
|
<br>
|
||||||
|
密码( 不建议使用中文 )
|
||||||
|
<br>
|
||||||
|
<input type="password" name="passwd" pattern="[^\u4E00-\u9FA5]+" oninput="value=value.replace(/[\u4E00-\u9FA5]/g,'')" required>
|
||||||
|
<br>
|
||||||
|
年龄
|
||||||
|
<br>
|
||||||
|
<input type="number" name="age" min="1" max="100" step="1" required>
|
||||||
|
<br>
|
||||||
|
<button type="submit">注册</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('lower').addEventListener('input', function() {
|
||||||
|
this.value = this.value.toLowerCase();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user