O'Reilly logo

Python Requests Essentials by Bala Subrahmanyam Varanasi, Rakesh Vidya Chandra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running the survey application

Hurray! We succeeded in creating an application which will allow the users to create a survey, retrieve a survey, update a survey, delete a survey, and cast the vote of a choice for a survey. Perform the following steps for running the server:

  1. Before running the server, let us go ahead and fill the contents of server.py with the following code:
    import sys
    
    from survey import app, db
    from survey import views
    
    def main():
        db.create_all()
        app.run(debug=True)
        return 0
    
    if __name__ == '__main__':
        sys.exit(main())
  2. Now, let us run the application using the runserver.py script as shown in the following lines:
    $ python runserver.py
    * Running on http://127.0.0.1:5000/
    * Restarting with reloader
    
  3. Now, the server is up and running. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required