In this video we will configure Flask with WTforms, we will take a look at flask inheritance, and how that works… and finally, we will enable a CSS framework called bootstrap to easily make our pages look amazing.
In the last video, we setup a very basic form on our web page to post data to our flask server using the HTML POST command.
Now we’re going to spice it up a bit and validate the input on those forms ..for example ..we’ll require input before hitting the submit button and have a min length requirement for the password and so on.
Our goal here is to create web apps and I’m going to assume that you don’t have too much experience with HTML and CSS.
Great if you do! but otherwise, WTfroms and Bootstrap will allow you to create powerful forms and handle the web design easily without too much coding.
WTFroms can provide additional security to your forms by verifying the input and preventing certain attacks such as cross site request forgery (CSRF). This will be important as your app develops.
Regardless of what you do, you’ll most likely need web forms to take input from the users.
Bootstrap is a CSS framework to help us style our websites faster and easier. , it also makes the web site responsive, meaning the web page will look good on any device and finally, it comes with a grid system to make placing html elements on a page easier.
the objective here is to build small functional web apps and these add-ons provide us with a quick and easy way to handle the design of the GUI without getting bogged down too much with HTML and CSS
This is not a web design tutorial – we simply want to use web pages as a GUI to our python apps so we’re going to use these powerful tools to do that for us.
So…let’s start with WTForms. I’ve added the libraries and the addition code, which I’ll walk through with you.
But… if you just want to jump in and use it …all this code in on my github page at the link below. I’ll also put this link in the comments for you.