Merge branch 'feature/random-refresh-page' into develop
commit
ad4be9baf3
10
slider.py
10
slider.py
|
@ -3,7 +3,7 @@
|
|||
from flask import Flask, render_template, send_from_directory, redirect, url_for
|
||||
from random import randint
|
||||
from os import listdir
|
||||
import random
|
||||
from random import choice
|
||||
|
||||
import config
|
||||
|
||||
|
@ -11,13 +11,13 @@ app = Flask(__name__)
|
|||
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return render_template("hello.html", num=randint(1, 23))
|
||||
def random():
|
||||
return render_template("random.html", refresh=config.refresh)
|
||||
|
||||
|
||||
@app.route("/random_image")
|
||||
@app.route("/random_image/")
|
||||
def random_image():
|
||||
filename = random.choice(listdir(config.imgdir))
|
||||
filename = choice(listdir(config.imgdir))
|
||||
return redirect(url_for("image", filename=filename))
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<p>Hello slider number {{ num }}!</p>
|
||||
<p><img src="{{ url_for("static", filename="cat.jpg") }}"></p>
|
||||
<p><a href="{{ url_for("image", filename="IMG_0001.jpg") }}">Image</a></p>
|
||||
<p><a href="{{ url_for("random_image") }}">Random Image</a></p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="{{ refresh }};url={{ url_for("random") }}">
|
||||
</head>
|
||||
<body bgcolor="black">
|
||||
<img src="{{ url_for("random_image") }}" style="height: 98%; width: 100%; object-fit: contain"/>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue