Rapid Flask
This course covers the essentials of web development in Python. Learn to develop a fully functional app in Flask using its features, and the basics of web development; input, processing, and output.
- Self-paced with Life Time Access
- Certificate on Completion
- Access on Android and iOS App
Get your web applications up and running in no time with Flask.
This course covers the essentials of web development in Python. It starts by showing you how to set up an interaction between client and server quickly and efficiently, before moving on to cover how to write templates to allow HTML to interact seamlessly with Python. From there, the course flows into receiving and processing input from your app’s users and grabbing data through web services. You’ll be surprised at the range of functionality you’ll find in a web app that takes only 45 minutes to develop!
The course shows you how to develop a fully functional app in Flask using simple but powerful features. You’ll learn different ways to utilize the input from your app’s users simply and securely. You’ll also discover how to integrate API calls with your app, and how to make template files so that the Python and HTML combo becomes simple and fun to work with.
This course covers all the essentials of web development; input, processing, and output. It’s really all you need to develop an engaging and interactive web app faster than ever before!
About the Author
Gareth Dwyer is a South African Computer Science student with several years of Python and web development experience. He first became interested in coding when he was 14, and this interest has only grown since then. His other computer-related interests include Information Security, Natural Language Processing, NoSQL databases, and most things Linux, while in his largely imagined free time he pursues interests in chess, philosophy, classical piano, and languages.
- Basic knowledge of HTML and CSS will be helpful but is not necessary
- Gear up with the tools you need to get started with web development in Flask
- Use familiar Python syntax that makes developing with Flask easy
- Establish better client-server communication for your apps
- Get better flexibility in your apps by combining Python logic with HTML view code
- Enhance the utility of your app by establishing methods for client input
- Easily control web APIs to combine data in useful ways
- Integrate attractive CSS elements to make your apps look great
- Create personalized user experiences with cookies and much more
We need to know what we'll achieve through this course, and set up the software and frameworks we'll be working with.
- Install pip
- Install Flask
- Set up the correct directory structure
We need to create a basic Flask app that we can extend to suit our needs.
- Create the directory structure
- Edit the .py file
- Run the script and view it in a web browser
We need our app to be able to deal with subpages and URL routing.
- Add new functions
- Dynamic routing
- Dynamic routing with type checking
We need to know how to get data from the API and return it to the client as HTML.
- Make a web request and parse the data
- Build up the HTML string with the data
- Return the string to the client
We need to separate our view code from our logic code for simplicity and efficiency.
- Create a Jinja template file
- Set up the dynamic variables
- Pass the variables into the template and render it
We need to create lists and tables inside our view files.
- Pass in a list of variables instead of individual variables
- Set up a Jinja loop to process the list
- Set up a Jinja if statement to change the font colour
We need to be able to search for more than one city. We'll pass in a search term, and then use the API to get the weather data for the matching result.
- Add a new route to the app to be searched by the URL
- Improve this by using a get parameter instead
- Parse the get parameter using the Flask request context
It's counter-intuitive for the user to have to modify the URL. We'll add a simple text input for the search query instead.
- Add a form to the template file
- Add the alternative method using POST requests
- Modify the routes to accept the POST data
Our web app uses plain HTML and isn't aesthetically pleasing. We'll add a stylesheet and a Favicon in order to improve the look.
- Create the CSS file
- Create the Favicon
- Link the app to the CSS and Favicon in the template file
The user shouldn't have to search for the same city all the time. We'll remember the user's default city using cookies and display this by default.
- Create a response object instead of rendering the template directly
- Read any existing cookies
- Add a checkbox to allow the user to choose whether or not to set the cookie
Our app is quite clean and simple, but other apps will require more functionality. We'll look at some of the better Flask extensions.
- An overview of databases
- An overview of user accounts and more about forms
- An overview of security