mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: mock images issue
This commit is contained in:
parent
71129bf510
commit
a33a17803d
2 changed files with 4 additions and 3 deletions
|
|
@ -184,11 +184,12 @@ async def create_initial_data(request: Request):
|
|||
name_in_disk = f"test_mock{course_id}.jpeg"
|
||||
|
||||
image = requests.get(
|
||||
"https://source.unsplash.com/random/800x600")
|
||||
"https://source.unsplash.com/random/800x600/?img=1")
|
||||
|
||||
# check if folder exists and create it if not
|
||||
if not os.path.exists("content/uploads/img"):
|
||||
os.makedirs("content/uploads/img")
|
||||
if not os.path.exists(f"content/uploads/img"):
|
||||
|
||||
os.makedirs(f"content/uploads/img")
|
||||
|
||||
with open(f"content/uploads/img/{name_in_disk}", "wb") as f:
|
||||
f.write(image.content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue