Skip to content

Commit

Permalink
updated dog url
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Jun 14, 2024
1 parent e712a90 commit 6ce3a33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
instance/
config.txt
/static/img/
/__pycache__/
/__pycache__/
/static/volume/
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from db_schema import Projects, db

dev = False # if true then uses config.txt to set environment variables
dev = True # if true then uses config.txt to set environment variables
if dev:
with open("config.txt", "r") as f:
for line in f.readlines():
Expand Down Expand Up @@ -338,10 +338,10 @@ def add_photo(

@app.route("/dog/")
def dog():
# get random dog image from /static/img/dog/ folder
dog_images = listdir("static/img/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("static/img/dog", dog_image)
return send_from_directory(app.config["UPLOAD_FOLDER"] + "dog", dog_image)


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

0 comments on commit 6ce3a33

Please sign in to comment.