title: Heroku Application Error - despite successful deploy
body: <p><strong>Background:</strong><br>I have a Flask app with RESTful API and webpages that I'm trying to deploy to Heroku. As a Python-based (app.py) project, I obviously deploy the 'python way'. The requirements include a <code>requirements.txt</code> file.</p>
  <p><strong>Issue:</strong><br>I did a <code>pip freeze</code> and had a tonne of libraries fill my Terminal. I figured 'what the heck, I'll copy the entire contents to a <code>requirements.txt</code> (and yes, I spelt it correctly!) and save in the root dir of my project, alongside my <code>main.py</code> file.<br><br>Whilst Heroku is deploying, it installs the requirements etc and <strong>says the app is deployed successfully</strong>, however when I navigate to my project, I'm given a Heroku generic 'Application Error' message (<a href="https://project-2-website.herokuapp.com" rel="nofollow noreferrer">here</a>).<br><BR><strong>USEFUL INFO:</strong></p>
  <p><strong>Logs:</strong> for my most recent build attempt - <br></p>
  <pre><code>-----&gt; Python app detected
  -----&gt; Requirements file has been changed, clearing cached dependencies
  -----&gt; Installing python-3.6.12
  -----&gt; Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
  -----&gt; Installing SQLite3
  -----&gt; Installing requirements with pip
         Collecting Flask==1.1.2
           Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
         Collecting Flask-Bootstrap==3.3.7.1
           Downloading Flask-Bootstrap-3.3.7.1.tar.gz (456 kB)
         Collecting flask-marshmallow==0.13.0
           Downloading flask_marshmallow-0.13.0-py2.py3-none-any.whl (9.9 kB)
         Collecting Flask-PyMongo==2.3.0
           Downloading Flask_PyMongo-2.3.0-py2.py3-none-any.whl (12 kB)
         Collecting Flask-RESTful==0.3.8
           Downloading Flask_RESTful-0.3.8-py2.py3-none-any.whl (25 kB)
         Collecting Flask-SQLAlchemy==2.4.4
           Downloading Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB)
         Collecting flaskerizer==0.0.8
           Downloading flaskerizer-0.0.8.tar.gz (17 kB)
         Collecting pymongo==3.11.0
           Downloading pymongo-3.11.0-cp36-cp36m-manylinux2014_x86_64.whl (508 kB)
         Collecting json2html==1.3.0
           Downloading json2html-1.3.0.tar.gz (7.0 kB)
         Collecting json5==0.9.5
           Downloading json5-0.9.5-py2.py3-none-any.whl (17 kB)
         Collecting beautifulsoup4==4.9.1
           Downloading beautifulsoup4-4.9.1-py3-none-any.whl (115 kB)
         Collecting Jinja2&gt;=2.10.1
           Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
         Collecting itsdangerous&gt;=0.24
           Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
         Collecting click&gt;=5.1
           Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
         Collecting Werkzeug&gt;=0.15
           Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
         Collecting dominate
           Downloading dominate-2.5.1-py2.py3-none-any.whl (29 kB)
         Collecting visitor
           Downloading visitor-0.1.3.tar.gz (3.3 kB)
         Collecting marshmallow&gt;=2.0.0
           Downloading marshmallow-3.7.1-py2.py3-none-any.whl (45 kB)
         Collecting six&gt;=1.9.0
           Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
         Collecting aniso8601&gt;=0.82
           Downloading aniso8601-8.0.0-py2.py3-none-any.whl (43 kB)
         Collecting pytz
           Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
         Collecting SQLAlchemy&gt;=0.8.0
           Downloading SQLAlchemy-1.3.19-cp36-cp36m-manylinux2010_x86_64.whl (1.3 MB)
         Collecting numpy
           Downloading numpy-1.19.1-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB)
         Collecting soupsieve&gt;1.2
           Downloading soupsieve-2.0.1-py3-none-any.whl (32 kB)
         Collecting MarkupSafe&gt;=0.23
           Downloading MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl (27 kB)
         Building wheels for collected packages: Flask-Bootstrap, flaskerizer, json2html, visitor
           Building wheel for Flask-Bootstrap (setup.py): started
           Building wheel for Flask-Bootstrap (setup.py): finished with status 'done'
           Created wheel for Flask-Bootstrap: filename=Flask_Bootstrap-3.3.7.1-py3-none-any.whl size=460123 sha256=9bd9e63bb6b77d2a2750200e52bb64f47e327c55fcf5d53e56273422c6897236
           Stored in directory: /tmp/pip-ephem-wheel-cache-n6hu4_1p/wheels/5b/f4/4f/26886e9f06b0c1b6d54104a1fb423ebc7e06d94cf69700348e
           Building wheel for flaskerizer (setup.py): started
           Building wheel for flaskerizer (setup.py): finished with status 'done'
           Created wheel for flaskerizer: filename=flaskerizer-0.0.8-py3-none-any.whl size=19420 sha256=651ddb678fae4fa5961d8a95cab2569b2b8a3adefed4440b80fb3bba26a95aa7
           Stored in directory: /tmp/pip-ephem-wheel-cache-n6hu4_1p/wheels/cc/1d/54/3c80ed968fd156ae6a6b44923127522538f8ade767dbd8d256
           Building wheel for json2html (setup.py): started
           Building wheel for json2html (setup.py): finished with status 'done'
           Created wheel for json2html: filename=json2html-1.3.0-py3-none-any.whl size=7596 sha256=cab0c712dd167dda857c2fa995b731fc5be5644adcd3a4425a8d8a33da05749e
           Stored in directory: /tmp/pip-ephem-wheel-cache-n6hu4_1p/wheels/ac/31/34/ddfd5ecba08389f839470d849288be216fcb22f1403eaa05df
           Building wheel for visitor (setup.py): started
           Building wheel for visitor (setup.py): finished with status 'done'
           Created wheel for visitor: filename=visitor-0.1.3-py3-none-any.whl size=3931 sha256=4ae43104c4bd7035ce0d468ea846a663c66444810b67338ef9df91be7245bcf8
           Stored in directory: /tmp/pip-ephem-wheel-cache-n6hu4_1p/wheels/a9/77/93/3b8a22ac46f57a22d0fd7b4912fff740bcbddbd720bd48508e
         Successfully built Flask-Bootstrap flaskerizer json2html visitor
         Installing collected packages: MarkupSafe, Jinja2, itsdangerous, click, Werkzeug, Flask, dominate, visitor, Flask-Bootstrap, marshmallow, six, flask-marshmallow, pymongo, Flask-PyMongo, aniso8601, pytz, Flask-RESTful, SQLAlchemy, Flask-SQLAlchemy, numpy, flaskerizer, json2html, json5, soupsieve, beautifulsoup4
         Successfully installed Flask-1.1.2 Flask-Bootstrap-3.3.7.1 Flask-PyMongo-2.3.0 Flask-RESTful-0.3.8 Flask-SQLAlchemy-2.4.4 Jinja2-2.11.2 MarkupSafe-1.1.1 SQLAlchemy-1.3.19 Werkzeug-1.0.1 aniso8601-8.0.0 beautifulsoup4-4.9.1 click-7.1.2 dominate-2.5.1 flask-marshmallow-0.13.0 flaskerizer-0.0.8 itsdangerous-1.1.0 json2html-1.3.0 json5-0.9.5 marshmallow-3.7.1 numpy-1.19.1 pymongo-3.11.0 pytz-2020.1 six-1.15.0 soupsieve-2.0.1 visitor-0.1.3
  -----&gt; Discovering process types
         Procfile declares types -&gt; (none)
  -----&gt; Compressing...
         Done: 75.5M
  -----&gt; Launching...
         Released v7
         https://project-2-website.herokuapp.com/ deployed to Heroku
  </code></pre>
  <p><strong>Flask code:</strong><br></p>
  <pre><code>import flask
  from flask import Flask, jsonify, Response, render_template
  from flask import redirect
  import pymongo
  from pymongo import MongoClient
  from bson import ObjectId, json_util
  import json
  
  cluster = pymongo.MongoClient(&quot;mongodb+srv://USERNAME:PASSWORD@cluster0.mpjcg.mongodb.net/&lt;dbname&gt;?retryWrites=true&amp;w=majority&quot;)
  db = cluster[&quot;simply_recipe&quot;]
  collection = db[&quot;recipes_collection&quot;]
  
  app = Flask(__name__)
  
  # This route returns the team's index page
  @app.route(&quot;/&quot;)
  def home():
      return render_template('index.html')
  
  # This route returns heesung's plot page of the team's website
  @app.route(&quot;/heesung/&quot;)
  def heesung():
      return redirect(&quot;https://heesung80.github.io/recipe/&quot;)
  
  # This route returns caitlin's plot page of the team's website
  @app.route(&quot;/caitlin&quot;)
  def caitlin_plots():
      return render_template('inner-page_caitlin.html')
  
  # This route returns all the recipe_collection data in JSON.
  @app.route(&quot;/recipes&quot;, methods=[&quot;GET&quot;])
  def get_recipes():
      all_recipes = list(collection.find({}))
      return json.dumps(all_recipes, default=json_util.default)
  
  if __name__ == &quot;__main__&quot;:
      app.run()
  </code></pre>
  <p>Does anyone have any suggestions, why my Flask app deploys successfully, but gives the Application Error?</p>