mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 17:19:42 +00:00
Add homepage
This commit is contained in:
parent
921544c4eb
commit
d7d54fb449
3 changed files with 33 additions and 20 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
# Copyright 2019 Mike Shoup
|
# Copyright 2019 Mike Shoup
|
||||||
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
@ -22,22 +22,9 @@ def create_app(test_config=None):
|
||||||
app = Flask(__name__, instance_relative_config=True)
|
app = Flask(__name__, instance_relative_config=True)
|
||||||
app.config.from_envvar('HUMULUS_SETTINGS')
|
app.config.from_envvar('HUMULUS_SETTINGS')
|
||||||
|
|
||||||
if test_config is None:
|
# Register blueprint for index page
|
||||||
# load the instance config, if it exists, when not testing
|
from . import home
|
||||||
app.config.from_pyfile('config.py', silent=True)
|
app.register_blueprint(home.bp)
|
||||||
else:
|
app.add_url_rule('/', endpoint='index')
|
||||||
# load the test config if passed in
|
|
||||||
app.config.from_mapping(test_config)
|
|
||||||
|
|
||||||
# ensure the instance folder exists
|
|
||||||
try:
|
|
||||||
os.makedirs(app.instance_path)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# a simple page that says hello
|
|
||||||
@app.route('/hello')
|
|
||||||
def hello():
|
|
||||||
return 'Hello, World!'
|
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
|
||||||
25
src/humulus/home.py
Normal file
25
src/humulus/home.py
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
"""This module handles routes for the home page"""
|
||||||
|
|
||||||
|
# Copyright 2019 Mike Shoup
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from flask import Blueprint, render_template
|
||||||
|
|
||||||
|
bp = Blueprint('home', __name__)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/')
|
||||||
|
def index():
|
||||||
|
"""Renders the homepage template"""
|
||||||
|
return render_template('index.html')
|
||||||
1
src/humulus/templates/index.html
Normal file
1
src/humulus/templates/index.html
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<h1>Hello</h1>
|
||||||
Loading…
Add table
Reference in a new issue