initial commit

This commit is contained in:
2022-08-28 13:02:29 +08:00
commit 184eb978b7
12 changed files with 84 additions and 0 deletions

5
app/__init__.py Normal file
View File

@ -0,0 +1,5 @@
from .app import app
from . import views
__all__ = ["app"]

3
app/app.py Normal file
View File

@ -0,0 +1,3 @@
from flask import Flask
app = Flask(__name__)

13
app/templates/index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>A Sample Python Flask Project</title>
</head>
<body>
<div>A Sample Python Flask Project</div>
<div>{{now}}</div>
</body>
</html>

3
app/views/__init__.py Normal file
View File

@ -0,0 +1,3 @@
import flask
from . import simple_views

15
app/views/simple_views.py Normal file
View File

@ -0,0 +1,15 @@
from datetime import datetime
import os
from ..app import app
from flask import Blueprint, render_template
simple_views = Blueprint("views", __name__, template_folder=os.path.join(
os.path.dirname(__file__), "templates"))
@simple_views.get("/")
def index_page():
return render_template("index.html", now=datetime.now())
app.register_blueprint(simple_views)