title: 500 Internal Server Error When Using Flask and Jinja
body: <p>I'm currently self-teaching myself Python using a book called "Head First: Python (2nd Edition)" and so far it has been good, but I'm currently stuck in the early stages of building a simple webapp. The webapp allows one to enter in a phrase and letters and then outputs the <code>intersection</code> of both. Since a good portion of the book builds off of this, I can't move forward by skipping this. I've been trying to find an error, but to no avail.</p>
  
  <p>All the code is provided by the book at: <a href="http://python.itcarlow.ie/ed2/ch05/webapp/" rel="nofollow noreferrer">http://python.itcarlow.ie/ed2/ch05/webapp/</a></p>
  
  <p>The file vsearch4web.py in the folder is the final version, so don't use that. This is where I am at instead with my vsearch4web.py folder:</p>
  
  <pre><code>from flask import Flask, render_template
  from vsearch import search4letters
  
  app = Flask(__name__)
  
  @app.route('/')
  def hello() -&gt; str:
      return 'Hello world from Flask!'
  
  @app.route('/search4')
  def do_search() -&gt; str:
      return str(search4letters('life, the universe, and everything','eiru,!'))
  
  @app.route('/entry')
  def entry_page() -&gt; 'html':
          return render_template('entry.html',the_title='Welcome to search4letters on the web!')
  
  app.run()
  </code></pre>
  
  <p>I have set up the folder structure as instructed:</p>
  
  <p>webapp folder --> vsearch4web.py
  static folder (subfolder of webapp) --> hf.css (from "static")
  templates folder (subfolder of webapp) --> base.html, entry.html and results.html (from "template")</p>
  
  <p>The files in the static folder and templates folder are downloadable in the above URL provided in the book.</p>
  
  <p>However, when I run vsearch4web.py, and I go to my browser and enter the loopback address (<a href="http://127.0.0.1:5000/entry" rel="nofollow noreferrer">http://127.0.0.1:5000/entry</a>), I get a "500 Internal Server Error". </p>
  
  <p>Both <a href="http://127.0.0.1:5000/" rel="nofollow noreferrer">http://127.0.0.1:5000/</a> and <a href="http://127.0.0.1:5000/search4" rel="nofollow noreferrer">http://127.0.0.1:5000/search4</a> work however. </p>
  
  <p>I've tried rechecking the code several times but I don't know what I am missing. </p>
  
  <p>Can someone please help?</p>
  
  <p>Thanks.</p>