30 lines
609 B
Python
Executable File
30 lines
609 B
Python
Executable File
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)}"
|
||
|
||
|