[PYTHON] I want to transition with a button in flask

SS 192.png  ボタンで遷移だけしたい。

things to do

If you press the button in "AAAA.html" with flask, it will transition to "BBBB.html".

environment

manner

Part of the contents of flask python

sample.py


from flask import Flask, request, render_template
app = Flask(__name__)

(Omission)

@app.route("/BBBB", methods=["POST"])
def move_BBBB():
    return render_template("BBBB.html")

(Omission)

Make sure to transition to BBBB.html when POST arrives.

templates/AAAA.html


{% block content %}
<form action="/BBBB" method="POST">
    <input type="submit" value="button">
</form>
{% endblock %}

Write the button in AAAA.html. Also prepare BBBB.html.

It seems that it is made with this, but I feel that something is wrong.

Recommended Posts

I want to transition with a button in flask
I want to work with a robot in python.
I want to print in a comprehension
I want to create a window in Python
I want to make a game with Python
I want to write to a file with Python
(Matplotlib) I want to draw a graph with a size specified in pixels
I want to embed a variable in a Python string
I want to easily implement a timeout in python
I want to climb a mountain with reinforcement learning
I want to write in Python! (2) Let's write a test
I want to randomly sample a file in Python
I want to split a character string with hiragana
I want to manually create a legend with matplotlib
I want to run a quantum computer with Python
I want to bind a local variable with lambda
I want to do ○○ with Pandas
I want to debug with Python
I want to make a blog editor with django admin
I want to start a jupyter environment with one command
I want to make a click macro with pyautogui (desire)
I want to make a click macro with pyautogui (outlook)
I want to use a virtual environment with jupyter notebook!
I want to install a package from requirements.txt with poetry
[Visualization] I want to draw a beautiful graph with Plotly
I want to make input () a nice complement in python
[Python] I want to add a static directory with Flask [I want to use something other than static]
I want to save a file with "Do not compress images in file" set in OpenPyXL
I want to detect objects with OpenCV
I want to use a wildcard that I want to shell with Python remove
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
I want to blog with Jupyter Notebook
I want to run Rails with rails s even in vagrant environment
I want to build a Python environment
I want to pip install with PythonAnywhere
I want to do a full text search with elasticsearch + python
I want to analyze logs with Python
I want to play with aws with python
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I want to create a pipfile and reflect it in docker
I want to embed Matplotlib in PySimpleGUI
I want to create a graph with wavy lines omitted in the middle with matplotlib (I want to manipulate the impression)
I want to convert a table converted to PDF in Python back to CSV
I want to sort a list in the order of other lists
Environment maintenance made with Docker (I want to post-process GrADS in Python
I want to color a part of an Excel string in Python
I got stuck in a flask application redirect with a reverse proxy in between
I want to make a web application using React and Python flask
I want to do a monkey patch only partially safely in Python
I want to make matplotlib a dark theme
I want to do Dunnett's test in Python
I want to easily create a Noise Model
I want to use MATLAB feval with python
I want to analyze songs with Spotify API 2
I want to INSERT a DataFrame into MSSQL
I tried to integrate with Keras in TFv1.1
I want to mock datetime.datetime.now () even with pytest!
I want to display multiple images with matplotlib.
I want to knock 100 data sciences with Colaboratory
I want to be an OREMO with setParam!
I don't want to take a coding test