Home>
Images are not displayed in the flask app launched with docker
I launched the flask app using docker, but the image is not displayed.
If i don't use docker, it will be displayed properly, but I don't understand the cause.
Below are the files for building the docker environment and the html files for the problematic pages.
docker-compose.yml
version: '3'
services: services:
flask:
build: ..
command: python3 app/app.py
ports: ports:
-"5000: 5000"
volumes:
--./app:/app
tty: true
container_name: CNN-app-with-flask
Dockerfile
FROM python: 3.7
COPY requirements.txt.
RUN pip install --upgrade pip
RUN pip install -r ./requirements.txt
RUN mkdir/app
result.html
{% extends "layout.html"%}
{% block content%}
Judgment result
{{result}}
<form method = "get" action = "/">
<button>Back</button>
</form>
{% endblock%}
Line 7 of this filefilepath
The file that contains the image firmly is specified in.
I would like somebody to teach.
-
Answer # 1
Related articles
- python - the web browser is garbled and the web application is not displayed
- python - i want to download images from flickr
- i want to click and number a few images like a switch in python
- i want to display images periodically in python, what should i do?
- display images by drag and drop on wxpython gui
- images are not displayed when sorting between smartphone and pc with htaccess
- python - typeerror when calculating the array of images called by imageopen ()
- ruby - images cannot be displayed with the bulletin board posting function in rails
- in [python] print (), if a scatter plot is displayed using a one-dimensional array that has the intended values, the distributio
- how to automate tweets with images from spython with json files
- python - i want to move images with pygame
- results are not displayed in python
- python - object is not displayed in html in django queryset
- python - error running flask in terminal
- python 3x - i want to set a response type bot that sends messages and images to discord with google colaboratory
- python - i want to connect the images in two folders in order
- python - problem that css is not loaded in html and cannot be displayed during web application creation
- python - error loading images in anaconda environment
- python - anaconda is not displayed in the terminal on mac
Trends
I don't know where the image file is placed, but isn't it okay if I dig static or DIR in the text and place it there?
The information presented is too half-hearted, so I think it's easier to get an answer if you show the minimum configuration and procedure that will cause the problem.
By the way, I tried the following in my environment, but the image was displayed without any problem.
◆ Execution result
stackoverflow.png is the stackoverflow logo file.