T
T
Timtaran2022-02-25 19:17:53
Python
Timtaran, 2022-02-25 19:17:53

Why doesn't Flask allow redirects and only output 1 page?

In general, everything was described in the question
Code:

import os
from flask import Flask, request, render_template
import requests

app = Flask(__name__, template_folder="/home/Timtaran/mysite")
app.debug = False

@app.route('/site')
def redirect():
    return 'aboba'
    """return('''<!DOCTYPE html>
    <html>
    <head>
    <p>Загрузка сайта... Пожалуйста подождите...</p>
    <meta http-equiv="refresh" content="10; url=https://www.youtube.com/watch?v=dQw4w9WgXcQ" />
    </head>
    <body>
  </body>
    </html>''')"""
@app.route('/')
def index():
    return render_template('index1.html')

index1.html:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Dev</title>
</head>
<body>
  <p>Внимание!!! Данный сайт находится в разработке, так что он может выглядить криво.</p>
<button id="myButton" class="float-left submit-button" >Перейти на сайт</button>

<script type="text/javascript">
    document.getElementById("myButton").onclick = function () {
        location.href = "http://tw1mc.tk/site";
    };
</script>
</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timtaran, 2022-02-25
@Timtaran

Domain setup error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question