Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:43:02+00:00 2026-06-18T08:43:02+00:00

I just started using Tornado. All I would like to do is click the

  • 0

I just started using Tornado. All I would like to do is click the submit button on index and be sent to login via the form action (this works so far); however, I am having trouble getting the posted data to login and making it work.
First question is, why am I getting the error:

 password = self.get_argument('password', None)
 NameError: name 'self' is not defined

Here’s the python so far:

 import os

 import tornado.web
 import tornado.ioloop

 class MainHandler(tornado.web.RequestHandler):
      def get(self):
          self.render("index.html")

 class LoginHandler(tornado.web.RequestHandler):
      def post(self):
          useremail = self.get_argument('useremail', None)
          password = self.get_argument('password', None)
          self.render("login.html") 

 def main():
     application = tornado.web.Application([ 
          (r"/", MainHandler),
          (r"/login", LoginHandler), 
          (r"/css/(.*)", tornado.web.StaticFileHandler, {"path": os.path.join(os. path.dirname(__file__), 'css')}),
          (r"/pictures/(.*)", tornado.web.StaticFileHandler, {"path": os.path.join(os.path.dirname(__file__), 'pictures')}),
     ])
     application.listen(8888)
     tornado.ioloop.IOLoop.instance().start()

 if __name__ == "__main__":
     main()

And secondly, is there anything else that looks glaringly wrong here? I am very uncertain as to how I’m supposed to render webpages like Login.html vs. Index.html, etc.

Syntactically, this seems to work also: return self.write(open("index.html", 'r').read())
What exactly does that do versus what I currently have?

Thanks for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:43:03+00:00Added an answer on June 18, 2026 at 8:43 am

    Your indentation is goofed, mixing spaces and tabs. Use python -tt to verify.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using CodeIgniter and would like to execute the query below. But
I just started using the new Eclipse 4.2 (Juno) Null Analysis. On code like
Just started using VBA and I'm trying to access all the data in a
Just started using Java (for Android, if that matters) and all I want is
I just started using OOP / CodeIgniter. I want to get assign the form
I just started using Caliburn.Micro and I've noticed in all the examples that the
I just started using PHPExcel in my Zend Framework project and now I would
I just started using QtCreator tonight, and it seems it puts all of the
Just started using AJAX today via JQuery and I am getting nowhere. As an
just started using JPA today, so i'm preety new to it. How would one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.