Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

Creating a new page on the platform

Nicholas Pringle edited this page May 3, 2013 · 41 revisions

This is a guide on how to create a new page on the KhanLatest platform:

  • Create a page template eg. new_page.html

      <!-- new_page.html -->  
      <html>  
        <head>  
          <title>A new Page!</title>  
        </head>  
       <body>  
        <h1>You made a new page...</h1>
        {{ some_value }}  
       </body>  
      </html>
    
  • create a page module eg. new_page.py

    • create a RequestHandler class called ViewNewpage(webapp2.RequestHandler)

    • render the template in the clas

      import request_handler
      class ViewNewPage(request_handler.RequestHandler):
          some_value = 100
          template_values = {
              'some_value': some_value,
          }
          self.render_jinja2_template('new_page.html', template_values)
      
  • import page_page.py into main.py

  • pass the new_page.ViewNewpage to a url like so: app = webapp2.WSGIApplication([('/new_page', new_page.ViewNewpage])

Clone this wiki locally