Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tecladocode/flashing-messages-post-app
A Flask application to show how to use message flashing
https://github.com/tecladocode/flashing-messages-post-app
Last synced: 17 days ago
JSON representation
A Flask application to show how to use message flashing
- Host: GitHub
- URL: https://github.com/tecladocode/flashing-messages-post-app
- Owner: tecladocode
- Created: 2019-09-19T08:06:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T06:40:17.000Z (almost 2 years ago)
- Last Synced: 2024-12-29T08:43:59.112Z (20 days ago)
- Language: HTML
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flashing messages
This short code repository contains a Flask application that uses render_template to show some HTML.
It is used in our blog post, "Flashing messages with Flask". Read that for more info!
In that blog post, we add some code to the app. You can see the final code by going to the branch `end`.
## Installing
You'll need `flask` to run this code sample. Install it like so:
```
pipenv install flask
```## Running the app
To run this app, enter the Pipenv shell and run the app via the Flask CLI. Make sure you're in the correct directory first:
```
pipenv run flask run
```## The routes
We have two endpoints in this starter app: `home`, and `profile`.
At the moment these only return HTML pages (from the `templates` folder). In the blog post we modify one of them to flash a message, as well as the corresponding endpoint to show the flashed messages.
```python
@app.route("/")
def home():
return render_template("home.jinja2")@app.route("/profile")
def profile():
return render_template("profile.jinja2")
```