Created base flask instance and moved static templates into correct location so they can be loaded using Jinja

This commit is contained in:
Luke Else 2023-12-27 21:36:53 +00:00
parent f64c378248
commit 1c5aa09668
8 changed files with 27 additions and 2 deletions

View File

@ -1 +0,0 @@

14
app.py
View File

@ -1,4 +1,16 @@
from flask import Flask, render_template
from web import blueprint
'''
Main entrypoint for Flask application.
Initialises any components that are needed at runtime such as the
Database manager...
'''
def main():
app = Flask(__name__)
# Register a blueprint
app.register_blueprint(blueprint)
app.run(debug=True)
if __name__ == "__main__":
print("Hello, World!")
main()

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

5
web/__init__.py Normal file
View File

@ -0,0 +1,5 @@
from flask import Blueprint
blueprint = Blueprint('endpoints', __name__)
from . import endpoints

9
web/endpoints.py Normal file
View File

@ -0,0 +1,9 @@
from . import blueprint
from flask import render_template
'''
Function responsible for displaying the main landing page of the site
'''
@blueprint.route('/')
def welcome_page():
return render_template('index.html')