Я сделал очень простой Flask-сервер и простой индекс, который содержит текст и 5 изображений.Изображения не загружаются, я посмотрел запросы и размер файла очень мал по сравнению с реальным размером изображения.Хотя ответы составляют около пары килобайт, часть изображений показывает.Сервер размещен локально на устройстве, которое подключено напрямую через Ethernet к моему ноутбуку.
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test Server</title>
</head>
<body>
<h5> HELLO WORLD!</h5>
<p>This is the server talking</p>
<p>I am currently sick but I'll be fine soon :)</p>
<img src="{{ url_for('static', filename='images/a.jpg') }}"></img>
<img src="{{ url_for('static', filename='images/b.jpg') }}"></img>
<img src="{{ url_for('static', filename='images/c.jpg') }}"></img>
<img src="{{ url_for('static', filename='images/d.jpg') }}"></img>
<img src="{{ url_for('static', filename='images/e.jpg') }}"></img>
</script>
</body>
</html>
server.py:
#!/usr/bin/env python2
import gevent
from gevent import monkey
gevent.monkey.patch_all()
from flask import Flask, render_template, url_for, copy_current_request_context, redirect, request, session, send_file, make_response, flash
from flask_socketio import SocketIO, emit
import os
app = Flask(__name__, template_folder="/test-server/current/src/templates/", \
static_folder="/test-server/current/src/static", \
static_url_path="/test-server/current/src/static")
basedir = os.path.abspath(os.path.dirname(__file__))
app.config.update(
SECRET_KEY = 'you-will-never-guess',
)
# Index route
@app.route("/")
@app.route('/home')
def index():
try:
nothing = ''
except Exception as err:
print(str(err))
finally:
response = render_template("index.html")
return response
# Starts the app listening to port 80
if __name__ == "__main__":
app.jinja_env.cache = {}
app.run(host='192.168.16.1',port=80, threaded=True)
И вот ответы, которые я получаю при перезагрузке страницы:
![enter image description here](https://i.stack.imgur.com/Ld6LO.png)