Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Matthew Starkey
PLUS
Matthew Starkey
Courses Plus Student 4,504 Points

Downloaded course files and seeing 404 error.

I have downloaded the flask course files for stage 3 start(bear builder). I have added the app.py file and coded the basic route for the index.html file. However when I run the file I get 404 error with method not allowed.

from flask import Flask
from flask import render_template

app = Flask(__name__)


app.route('/')
def index():
    return render_template('index.html')


if __name__ == '__main__':
    app.run(debug=True, port=8000, host='localhost')
Matthew Starkey
Matthew Starkey
Courses Plus Student 4,504 Points

The index.html file looks like this as well.

{% extends "layout.html" %}
{% block content %}
<!--Enter Name -->
<div class="enter-name">
    <div class="grid-100">
        <img src="/static/img/bear_avatar.svg" class="bear-avatar" />
    </div>
    <div class="grid-100">
        <form action="" method="POST">
            <label>Name your bear</label>
            <input type="text" name="name" value="" autofocus>
            <input type="submit" value="Let's build it!">
        </form>
    </div>
</div>
{% endblock %}