Update app.py
Browse files
app.py
CHANGED
|
@@ -9,24 +9,54 @@ HTML_TEMPLATE = """
|
|
| 9 |
<meta charset="UTF-8">
|
| 10 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 11 |
<title>Flask App with Iframe</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
</head>
|
| 13 |
<body>
|
| 14 |
<h1>Flask App with Iframe</h1>
|
| 15 |
-
<iframe
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 21 |
</body>
|
| 22 |
</html>
|
| 23 |
"""
|
| 24 |
|
| 25 |
@app.route('/')
|
| 26 |
def index():
|
| 27 |
-
"""
|
| 28 |
-
Renders the main page with an embedded iframe directly from a string.
|
| 29 |
-
"""
|
| 30 |
return render_template_string(HTML_TEMPLATE)
|
| 31 |
|
| 32 |
if __name__ == '__main__':
|
|
|
|
| 9 |
<meta charset="UTF-8">
|
| 10 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 11 |
<title>Flask App with Iframe</title>
|
| 12 |
+
<style>
|
| 13 |
+
body {
|
| 14 |
+
font-family: sans-serif;
|
| 15 |
+
margin: 0;
|
| 16 |
+
padding: 0;
|
| 17 |
+
box-sizing: border-box;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
h1 {
|
| 21 |
+
text-align: center;
|
| 22 |
+
padding: 1rem;
|
| 23 |
+
background-color: #f0f0f0;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.iframe-container {
|
| 27 |
+
width: 100%;
|
| 28 |
+
overflow: hidden; /* Prevent scrolling */
|
| 29 |
+
padding-bottom: 56.25%; /* 16:9 aspect ratio (you can adjust) */
|
| 30 |
+
position: relative;
|
| 31 |
+
height: 0;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.iframe-container iframe {
|
| 35 |
+
position: absolute;
|
| 36 |
+
top: 0;
|
| 37 |
+
left: 0;
|
| 38 |
+
width: 100%;
|
| 39 |
+
height: 100%;
|
| 40 |
+
border: 0;
|
| 41 |
+
}
|
| 42 |
+
</style>
|
| 43 |
</head>
|
| 44 |
<body>
|
| 45 |
<h1>Flask App with Iframe</h1>
|
| 46 |
+
<div class="iframe-container">
|
| 47 |
+
<iframe
|
| 48 |
+
src="https://rebus.tg/site/67ab09cbd76e2/index"
|
| 49 |
+
frameborder="0"
|
| 50 |
+
allowfullscreen> <!-- Important for mobile -->
|
| 51 |
+
</iframe>
|
| 52 |
+
</div>
|
| 53 |
</body>
|
| 54 |
</html>
|
| 55 |
"""
|
| 56 |
|
| 57 |
@app.route('/')
|
| 58 |
def index():
|
| 59 |
+
"""Renders the main page with an embedded iframe, adapted for mobile."""
|
|
|
|
|
|
|
| 60 |
return render_template_string(HTML_TEMPLATE)
|
| 61 |
|
| 62 |
if __name__ == '__main__':
|