I cannot in any way disable the Flask/Werkzeug logs. I am developing a site for a board game and when the lobby starts all the clients request the images of the cards at the same time. I think removing all these prints can save quite a bit of time.
If you have any other suggestions please share them 😉
Here my run.py
from server import create_app
from global_vars import socketio, test
from flask_cors import CORS
app = create_app()
CORS(app)
#socketio = SocketIO(app, cors_allowed_origins="*")
socketio.init_app(app)
if test == True:
socketio.run(app, host='0.0.0.0', port=80)
elif test == False:
context = ('/fullchain.pem', '/privkey.pem')
socketio.run(app, host='0.0.0.0', port=443, ssl_context=context)
global_vars.py
from flask import Blueprint
from flask_socketio import SocketIO
from server.classes import PartyManager
from json import dump
#from socketio_instance import socketio
test = True
ip_address = "...."
domain = "domain:443"
data = {
'ip': ip_address,
'domain': domain
}
if test == True:
data = {
'ip': "localhost",
'domain': "http://localhost"
}
with open('server/static/server_stats.json', 'w') as f:
dump(data, f)
socketio = SocketIO(cors_allowed_origins="*")
main = Blueprint('main', __name__, static_folder='static')
partyManager = PartyManager()
Here are the logs I’m referring to
192.168.57.38 - - [17/May/2024 10:16:15] "GET /socket.io/?EIO=4&transport=polling&t=O-5duW0 HTTP/1.1" 200 278 0.001012
192.168.57.38 - - [17/May/2024 10:16:16] "POST /socket.io/?EIO=4&transport=polling&t=O-5duXo&sid=7Ijxos4NlMtLk318AAAC HTTP/1.1" 200 218 0.000995
Thank you all
I would like to be able to disable the logs
New contributor
Emanuele Costanzo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.