To actually see the homepage, we will implement a controller.
- [Narrator] Welcome back.…We used web templates to create a homepage,…but now how do we actually see the homepage in the browser?…Let's look back at the Request-Response Cycle.…We just created a template, indexed at html,…and we placed it inside the templates folder.…For us to see this page in the browser,…we need to map a URL to it, and we do this in routes.py.…So let's do this next.…Open up routes.py, and modify it to look like this.…First, import the Flask class,…and the function render_template.…
Then create a new usable instance of the Flask class…and save it into the variable app.…Third, map the URL "/" to the Python function index.…The Python function uses the Flask function render_template…to render index.html.…So now when a user types in the URL "/",…the function index will run and return the page index.html.…Finally, finish up the file with this if statement,…app.run runs the app on a local server,…the debug=True flag here is set so that we'll see…any error messages along the way.…
So that does it.…Go to the command line and type pwd,…
The need for talented developers is greater than ever before. A basic grounding in a framework as simple, powerful, and easy-to-learn as Flask—a Python micro framework—can help launch your programming career. Get a basic grounding in the fundamental concepts of web development, as well as the hands-on experience required to successfully build web apps with Flask, in this course with Packt trainer Lalith Polepeddi.
It starts with turning your computer into a modern development machine. Then learn everything you need to know about Flask: models, views, controllers, web templates, forms, validation, and API interactions. Lalith shows how to apply these concepts and develop a powerful database-backed Flask app, including a full authentication system. Finally, Lalith shows how to extend the app's functionality by integrating it with third-party APIs. When you finish this course, you will be fully equipped to build your very own custom web apps with Flash.
- Setting up your development environment
- Creating a homepage
- Building templates
- Routing with Flask
- Deploying to Heroku
- Storing data
- Creating and rendering forms
- Validating form data
- Creating a user authentication system for login and logout
- Implementing location-based app features
Skill Level Beginner
Up and Running with Python and Djangowith Caleb Smith1h 11m Intermediate
1. Setting Up the Environment
2. Getting Started
3. Storing Data
4. Signing Up
5. Logging In and Logging Out
6. Authorization and User Roles
7. Bookmarking Places
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.