OpenTechSchool – Files & Templates
So you’ve seen how to send out some basic text with a simple Flask application, and the languages that are used to build the web: HTML, CSS and Javascript. Serving text isn’t enough though - what if we want to serve some actual files? Luckily, Flask comes prepared. All you have to do is create a folder in the same directory as catseverywhere.py with the special name of static. Any file you put in that folder will be served by Flask automatically! It’s one of the nice functionalities provided to you by Flask’s authors. You can do this with your computer’s file browser, or on the command line by typing mkdir static. So, if you made a file in the static folder called cats.gif, and you’d normally access your application by visiting the url http://127.0.0.1:5000, then you can view that file by going to http://127.0.0.1:5000/static/cats.gif. Check this works for you by downloading a funny image from the internet (there are plenty at imgur), putting it in the static folder, running your Flask
OpenTechSchool – Files & Templates OpenTechSchool Websites with Python Flask Files & Templates Home Core Setting up Hello, World! Languages of the Web Files & Templates Forms Form Submission Data Structures Extras Learning HTML and CSS Professional CSS Keeping track of users Using a database Hosting on Heroku Files So you’ve seen how to send out some basic text with a simple Flask application, and the languages that are used to build the web: HTML, CSS and Javascript. Serving text isn’t enough though - what if we want to serve some actual files? Luckily, Flask comes prepared. All you have to d
Explore this link on the map →related reading
- The Flask Mega-Tutorial, Part II: Templates - miguelgrinberg.comblog.miguelgrinberg.com
- Flask Project Structure: Build a Scalable Web App – Real Pythonrealpython.com
- How to Build a Personal Webpage from Scratch – Alex Rutarrutar.org
- Organize Flask Apps with Blueprintshackersandslackers.com
- Use a Flask Blueprint to Architect Your Applications – Real Pythonrealpython.com
- Flask - Full Stack Pythonfullstackpython.com
- The Flask Mega-Tutorial, Part I: Hello, World! - miguelgrinberg.comblog.miguelgrinberg.com
- The Flask Mega-Tutorial, Part III: Web Forms - miguelgrinberg.comblog.miguelgrinberg.com
- How To Create a React + Flask Project - miguelgrinberg.comblog.miguelgrinberg.com
- Streamlit • A faster way to build and share data appsstreamlit.io
- Blueprints and Views | G-Testerhuohuoren4.github.io
- Deploying a Flask App to Render | TestDriven.iotestdriven.io