Skip to content

Commit

Permalink
dog workey
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Jun 15, 2024
1 parent 6ce3a33 commit 67370b8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import wraps
from logging import INFO, basicConfig, info, warning
from os import environ, getenv, path, getcwd, makedirs, listdir
from random import randint
from random import choice

from flask import (
Flask,
Expand Down Expand Up @@ -339,9 +339,8 @@ def add_photo(
@app.route("/dog/")
def dog():
# serve random dog image
dog_images = listdir(app.config["UPLOAD_FOLDER"] + "dog")
dog_image = dog_images[randint(0, len(dog_images) - 1)]
return send_from_directory(app.config["UPLOAD_FOLDER"] + "dog", dog_image)
dog_image = choice(listdir(app.config["UPLOAD_FOLDER"][1:] + "dog/"))
return send_from_directory(app.config["UPLOAD_FOLDER"][1:] + "dog/", dog_image)


@app.route(DOG_URL, methods=["GET", "POST"])
Expand Down

0 comments on commit 67370b8

Please sign in to comment.