Here are resources that you can use to build your web project:
Next, let’s take a look at coding the application for the web. Now, you’re going to see that simple addition program created for the web using
flask. If you’re not aware of how
flask works, Real Python has many courses available to get you up to speed. Firstly, we’ll import all the required elements from
Flask application is created. To allow for safe use of the session cookie we’ll need to add a
.secret_key, and obviously, in a real application, that would be kept secret from everyone.
Now, you’ll see a definition of the application’s routes by creating functions which are wrapped in the
@app.route. This function will output a simple HTML form, which I’m going to wrap in triple quotes (
02:03 The result is calculated and the result is then returned to the user. In this case, there’s not any HTML formatting, but you can imagine there would be even more overhead if a fully-formatted HTML page was going to be returned to the user.
Become a Member to join the conversation.