-
Notifications
You must be signed in to change notification settings - Fork 508
Bluebrint causes 404 not found #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi. This often happens when running the app doesn't necessarily register the blue print. How are you running it? |
Hey Mike So I've kinda figured out the cause, but unsure of how to resolve entirely. It seems that when calling
Here's the full app.py:
If I remove the conditional and call
Do you know what may be the issue? |
Hi. Yes, that's the problem. You're setting up the blueprints in main() but import sys
import flask
app = flask.Flask(__name__)
def main():
app.run(debug=True)
def register_blueprints():
from views import home_views
app.register_blueprint(home_views.blueprint)
register_blueprints()
if __name__ == '__main__':
main() That'll do what you want and keep flask run working. |
I ran the code from the command line in the final folder of ch06_routing using flask run but get 404 not found for both the homepage and the about page. This was the same when I followed along. The app worked fine before I added the blueprint.
I have a windows 10 machine with python 3.7.3 and I'm using a virtual environment.
The text was updated successfully, but these errors were encountered: