I am trying to organize my flask project, but there's something wrong. I have this directory:
app/
__init__.py
views/
pages.py
On my __init__.py
file I've imported the pages
object and
registered it as a blue print.
This is the code on my pages.py
file.
from flask import Blueprint, render_template
pages = Blueprint('pages', __name__) #no prefix
@pages.route('/')
def index():
return '<h1>in index.html</h1>'
@pages.route('/home')
def home():
return '<h1>in home.html</h1>'
If I run the flask app, open the browser, and go to localhost:5000
,
I will see the headline 'in index.html'.
But if I go to localhost:5000/home
, I will get the message 404 Not Found message
.
Does anyone know the reason for this behavior?