title: Tornado rediret incur TypeError: initialize() missing 1 required positional argument: 'url'
body: <p>I am new to tornado and web service development, and currently implementing a tiny web for practising tornado module.</p>
  
  <p>This is the python code I used for my server</p>
  
  <pre><code>import bcrypt
  import concurrent.futures
  #import MySQLdb
  #import markdown
  import os.path
  import re
  import subprocess
  #import torndb
  import tornado.escape
  from tornado import gen
  import tornado.httpserver
  import tornado.ioloop
  import tornado.options
  import tornado.web
  import unicodedata
  from tornado.options import define, options
  
  define("port",default=8889,help='run on the given port',type=int)
  
  
  class HomeHandler(tornado.web.RequestHandler):
  
      def get(self):
          #login here
          self.render('index.html')
  
      def post(self):
          def readcodebook(codebook):
              with open(codebook,'r+') as f:
                  CodeLines=f.read().split('\n')
                  combinations={}
                  for c in CodeLines:
                      if len(c)&gt;0:
                          combinations[c.split('\t')[0]]=c.split('\t')[1]
              return combinations
          UserFile='/home/john/PyServer/Users/codebook.txt'
          CodeBook=readcodebook(UserFile)
  
          if self.get_argument("login") in CodeBook.keys():
              if CodeBook[self.get_argument("login")]==self.get_argument("password"):
                  #correct pwd
                  self.redirect(self.get_argument("next","/display/"))
              else:
                  #incorrect pwd
                  self.render("index.html", error='incorrect password!')
                  return
          else:
              #user not found
              self.render("index.html", error="account not found!")
              return
  
  
  class DisplayHandler(tornado.web.RedirectHandler):
      def get(self):
          self.render("displaycontent.html")
      pass
  
  
  class Application(tornado.web.Application):
      def __init__(self):
          handlers = [
              (r"/", HomeHandler),
              (r"/display/", DisplayHandler),
          ]
          settings = dict(
              #blog_title=u"Tornado Blog",
              template_path=os.path.join(os.path.dirname(__file__), "templates"),
              static_path=os.path.join(os.path.dirname(__file__), "static"),
              #ui_modules={"Entry": EntryModule},
              #xsrf_cookies=True,
              #cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
              #login_url="/auth/login",
              debug=True,
          )
          tornado.web.Application.__init__(self,handlers,**settings)
  
  if __name__=="__main__":
      tornado.options.parse_command_line()
      http_server=tornado.httpserver.HTTPServer(Application())
      http_server.listen(options.port)
      tornado.ioloop.IOLoop.instance().start()
  </code></pre>
  
  <p>and this is the index.html for user logon:</p>
  
  <pre><code>CSSFlow
  Login Form
  Previous
  Next
  
      Twitter
      Facebook
      RSS
      Newsletter
  
  &lt;!DOCTYPE html&gt;
  &lt;!--[if lt IE 7]&gt; &lt;html class="lt-ie9 lt-ie8 lt-ie7" lang="en"&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt; &lt;html class="lt-ie9 lt-ie8" lang="en"&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt; &lt;html class="lt-ie9" lang="en"&gt; &lt;![endif]--&gt;
  &lt;!--[if gt IE 8]&gt;&lt;!--&gt; &lt;html lang="en"&gt; &lt;!--&lt;![endif]--&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
    &lt;title&gt;Login Form&lt;/title&gt;
    &lt;link rel="stylesheet" href="css/style.css"&gt;
    &lt;!--[if lt IE 9]&gt;&lt;script src="//html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;section class="container"&gt;
      &lt;div class="login"&gt;
        &lt;h1&gt;Login to Web App&lt;/h1&gt;
        &lt;form method="post" action="/"&gt;
          &lt;p&gt;&lt;input type="text" name="login" value="" placeholder="Username or Email"&gt;&lt;/p&gt;
          &lt;p&gt;&lt;input type="password" name="password" value="" placeholder="Password"&gt;&lt;/p&gt;
          &lt;p class="remember_me"&gt;
            &lt;label&gt;
              &lt;input type="checkbox" name="remember_me" id="remember_me"&gt;
              Remember me on this computer
            &lt;/label&gt;
          &lt;/p&gt;
          &lt;p class="submit"&gt;&lt;input type="submit" name="commit" value="Login"&gt;&lt;/p&gt;
        &lt;/form&gt;
      &lt;/div&gt;
  
      &lt;div class="login-help"&gt;
        &lt;p&gt;Forgot your password? &lt;a href="index.html"&gt;Click here to reset it&lt;/a&gt;.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/section&gt;
  
    &lt;section class="about"&gt;
      &lt;p class="about-links"&gt;
        &lt;a href="http://www.cssflow.com/snippets/login-form" target="_parent"&gt;View Article&lt;/a&gt;
        &lt;a href="http://www.cssflow.com/snippets/login-form.zip" target="_parent"&gt;Download&lt;/a&gt;
      &lt;/p&gt;
      &lt;p class="about-author"&gt;
        &amp;copy; 2012&amp;ndash;2013 &lt;a href="http://thibaut.me" target="_blank"&gt;Thibaut Courouble&lt;/a&gt; -
        &lt;a href="http://www.cssflow.com/mit-license" target="_blank"&gt;MIT License&lt;/a&gt;&lt;br&gt;
        Original PSD by &lt;a href="http://www.premiumpixels.com/freebies/clean-simple-login-form-psd/" target="_blank"&gt;Orman Clark&lt;/a&gt;
    &lt;/section&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
      Live Demo
      HTML Source
      SCSS Source
  
      Tweet
      Share
  
      View Article
      Download
      Download All
  
  90% Unlimited Downloads Choose from Over 300,000 Vectors, Graphics &amp; Photos.ads via Carbon
  </code></pre>
  
  <p>The problem now is that tornado will throw an uncaught exception with description below and shows Error 404 not found in web browser, when I click submit button in index.html with correct username and password:</p>
  
  <pre><code>[E 170108 11:21:55 http1connection:54] Uncaught exception
      Traceback (most recent call last):
        File "/home/gaobo/anaconda3/lib/python3.5/site-packages/tornado/http1connection.py", line 238, in _read_message
          delegate.finish()
        File "/home/gaobo/anaconda3/lib/python3.5/site-packages/tornado/httpserver.py", line 289, in finish
          self.delegate.finish()
        File "/home/gaobo/anaconda3/lib/python3.5/site-packages/tornado/web.py", line 2022, in finish
          self.execute()
        File "/home/gaobo/anaconda3/lib/python3.5/site-packages/tornado/web.py", line 2042, in execute
          **self.handler_kwargs)
        File "/home/gaobo/anaconda3/lib/python3.5/site-packages/tornado/web.py", line 183, in __init__
          self.initialize(**kwargs)
      TypeError: initialize() missing 1 required positional argument: 'url'
  </code></pre>
  
  <p>Could anybody here point out a way to fix this problem? Thanks a lot!</p>