Render Template won’t work for some reason

  docker, flask, python

Please help I’m following a tutorial for flask but every time I try to build up this one application the route returns an internal server error and the problem seems to be with "render template".

Here’s how I structured my app:



Here’s the code in each of the files.


from flask import Flask, render_template
from flask_restful import Resource, Api
import requests

app = Flask(__name__)
api = Api(app)

def Hello():
    return '''<h1> Reading Archive</h1>
<p>A what would u like to read today?.</p>'''

@app.route('/books') #route 2
def books():
    return render_template("index.html")
if __name__ == '__main__':'','3333')


FROM python:3
RUN pip install flask
RUN pip install requests
RUN pip install flask_restful
CMD [ "python", "./"]

-> index.html

<!DOCTYPE html>
        A Small Library!
    <h1>** Library ** </h1>
    <h3><u> Books in the Library:</u></h3>

    <p><b>Title: </b><i>Astrophysics For People in a Hurry</i> <br>
        <b>Author: </b> Neil DeGrasse Tyson <br>
        <b>About:</b> Basic questions about the universe put into simple words by everyone's favourite scientist. <br>
        <b>Year published: </b> 2017 <br>
        <b>Genre: </b> Science, Non-Fiction. <br>

        <p><b>Title: </b><i>The Shadow over Innsmouth</i><br>

            <b>Author: </b> H.P Lovecraft<br>
            <b>About:</b> A small fishing town in Massachusetts hides a dark secret underneath its shores.<br>
            <b>Year published: </b> 1936<br>
            <b>Genre: </b> Lovecraftian Horror.<br>

The HTML file works perfectly fine on its own and the first Route from works fine except with I type /books in Docker.
Please note I’m super new to Flask and I’m still learning. Thanks if you’ve answered!

Source: Python Questions