diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/config.py b/config.py new file mode 100644 index 0000000..0b692c8 --- /dev/null +++ b/config.py @@ -0,0 +1 @@ +imgdir = "/home/mandlm/Foto Export/2018/09/2018-09-03" diff --git a/slider.py b/slider.py index db343c8..a695783 100755 --- a/slider.py +++ b/slider.py @@ -1,8 +1,10 @@ #!/usr/bin/python3 -from flask import Flask, render_template +from flask import Flask, render_template, send_from_directory from random import randint +import config + app = Flask(__name__) @@ -11,5 +13,10 @@ def hello(): return render_template("hello.html", num=randint(1, 23)) +@app.route("/img/") +def image(filename): + return send_from_directory(config.imgdir, filename) + + if __name__ == "__main__": app.run() diff --git a/templates/hello.html b/templates/hello.html index 77172c2..1a0f266 100644 --- a/templates/hello.html +++ b/templates/hello.html @@ -2,5 +2,6 @@

Hello slider number {{ num }}!

+

Image