Skip to Content
Cloud Native Python
book

Cloud Native Python

by Manish Sethi
July 2017
Intermediate to advanced
374 pages
8h
English
Packt Publishing
Content preview from Cloud Native Python

Creating tweets from users

Before we start writing our web page, we need to create a route to create tweets. This can be done as follows:

    from flask import render_template 
 
    @app.route('/addtweets') 
    def addtweetjs(): 
     return render_template('addtweets.html') 

Now that, we have created the route, let's create another form in addtweets.html, which will ask the user for the required information related to tweets, and help them submit the information:

    <html> 
     <head> 
      <title>Twitter Application</title> 
     </head> 
    <body> 
    <form > 
     <div class="navbar"> 
       <div class="navbar-inner"> 
           <a class="brand" href="#">Tweet App Demo</a> 
       </div> 
      </div> 
   <div id="main" class="container"> <table class="table table-striped"> Username: <input placeholder="Username" type="username"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for DevOps

Python for DevOps

Noah Gift, Kennedy Behrman, Alfredo Deza, Grig Gheorghiu
Cloud Native

Cloud Native

Boris Scholl, Trent Swanson, Peter Jausovec

Publisher Resources

ISBN: 9781787129313Supplemental Content