Files
open-ww3-project-ww3-tw/blueprint/blog_views.py

30 lines
609 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from flask import Blueprint, render_template
from database import get_owp_db
import os
blog_bp = Blueprint('blog', __name__)
@blog_bp.route('/')
def home():
db = get_owp_db()
return render_template('home.html')
@blog_bp.route('/about/')
def about():
return render_template('about.html')
pass
@blog_bp.route('/db_test/')
def test_db():
db = get_owp_db()
try:
cur = db.execute('SELECT sqlite_version();')
ver = cur.fetchone()[0]
return f"数据库连接成功SQLite 版本是: {ver}"
except Exception as e:
return f"连接失败: {str(e)}"