v.1.1.0 更新了文件结构目录,不在依靠apache进行部署,使用flask作为后端框架
This commit is contained in:
1 parent
77698ed1d6
commit
a710d7de9e
7 files changed
+17
-35
No files matched your search
+12
-30
@@ -1,36 +1,18 @@
|
||||
from flask import Flask, send_file
|
||||
from captcha import generate_captcha
|
||||
from flask import Flask, render_template
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/captcha')
|
||||
def captcha():
|
||||
image = generate_captcha()
|
||||
return send_file(image, mimetype='image/png')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
# Backend/app.py
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from config import Config
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
# 导入并注册你的蓝图,视图等
|
||||
# from your_application_module import your_blueprint
|
||||
|
||||
# 示例用户模型
|
||||
class User(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String(80), unique=True, nullable=False)
|
||||
password = db.Column(db.String(200), nullable=False)
|
||||
|
||||
# 创建数据库表
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
@app.route('/')
|
||||
def home():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/signin')
|
||||
def signin():
|
||||
return render_template('signin.html')
|
||||
|
||||
@app.route('/signup')
|
||||
def signup():
|
||||
return render_template('signup.html')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,15 +3,15 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<title>Homepage</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="signin.html">Sign In</a></li>
|
||||
<li><a href="signup.html">Sign Up</a></li>
|
||||
<li><a href="{{ url_for('signin') }}">Sign In</a></li>
|
||||
<li><a href="{{ url_for('signup') }}">Sign Up</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<title>Sign In</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<title>注册</title>
|
||||
</head>
|
||||
<body>
|
||||
Reference in new issue
Block a user