Intentando cambiar el fondo con mi entrada de URL usando jinja2/flask junto con python/javascript.
La alerta funciona. Sin embargo, el color de fondo no. Funciona en un archivo que solo tiene html/js/py.
HTML:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}"> <script type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script> <title>♟️Checkerboard</title> </head> <body> <div class = "container"> {{output}} </div> </body> </html>Pitón
from flask import Flask, render_template, request, redirect app = Flask(__name__) @app.route('/') def hello(): output = "hello world" return render_template('index.html', output = output) if __name__=="__main__": app.run(debug=True)JAVASCRIPT
alert("Testing"); document.body.style.backgroundColor = "red";Básicamente, todos los enlaces de archivos han demostrado funcionar. document.body.style.backgroundColor = "rojo"; demostrado que funciona. document.body.style.backgroundColor = "rojo"; no funciona en jinja/flask.
Por favor ayuda.