Serving static resources
Web pages contain several types of static resources, such as images, videos, CSS, and so on. In this recipe, we will see how you can manage such static resources for your module.
Getting ready
For this recipe, we will display an image on the page. Grab the my_hostel
module from the previous recipe. Select any image from your system and put that image inside the /
my_hostel/static/src/img
directory.
How to do it...
Follow these steps to show an image on the web page:
- Add your image to the
/
my_hostel/static/src/img
directory. - Define the new route in
controller
. In the code, replace the image URL with the URL of your image:Â Â Â Â Â Â Â Â @http.route('/demo_page', type='http', auth='none') Â Â Â Â Â Â Â Â def students(self): Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â image_url = '/my_hostel...