title: Flask throwing 500 internal server error
body: <p>This is what my routes.py looks like. Basically its a crawler which crawls all youtube video links within a page. This code works fine standalone (not in flask). However, when i try to make it work via flask, it throws 500 internal server error. Any kind of help will be appreciated.</p>
  
  <pre><code>from flask import Flask, render_template
  from BeautifulSoup import BeautifulSoup
  import requests
  app = Flask(__name__)
  
  @app.route("/")
  def main():
      url="https://www.youtube.com/user/EminemVEVO/videos"
      source_code=requests.get(url)
      text_source_code=source_code.text
      final_code=BeautifulSoup(text_source_code)
      video_url=final_code.findAll('a',{'class':'yt-uix-sessionlink yt-uix-tile-link  spf-link  yt-ui-ellipsis yt-ui-ellipsis-2'})
  
      for i in video_url:
          if "/watch?v=" in i.get('href'):
              j= i.get('href')
              j=j.replace("/watch?v=","")
              print "http://youtube.com"+j
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>Stack trace is below</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
      return self.wsgi_app(environ, start_response)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
      response = self.full_dispatch_request()
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1478, in full_dispatch_request
      response = self.make_response(rv)
    File "/Library/Python/2.7/site-packages/flask/app.py", line 1566, in make_response
      raise ValueError('View function did not return a response')
  ValueError: View function did not return a response
  </code></pre>