initial commit
This commit is contained in:
5
app/__init__.py
Normal file
5
app/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from .app import app
|
||||
|
||||
from . import views
|
||||
|
||||
__all__ = ["app"]
|
3
app/app.py
Normal file
3
app/app.py
Normal file
@ -0,0 +1,3 @@
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
13
app/templates/index.html
Normal file
13
app/templates/index.html
Normal 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
3
app/views/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
import flask
|
||||
|
||||
from . import simple_views
|
15
app/views/simple_views.py
Normal file
15
app/views/simple_views.py
Normal 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)
|
Reference in New Issue
Block a user