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. To access the application on a web browser, visit the URL—http://127.0.0.1:5000/.

We are done!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.173.238