bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.33k stars 1.46k forks source link

debug=True doesn't work | Bottle 0.12.25 version #1441

Open Armen-Jean-Andreasian opened 4 months ago

Armen-Jean-Andreasian commented 4 months ago

Howdy! Decided to discover other libraries today, so I took Bottle. I liked it. 'Hit Ctrl-C to quit' was fun. Like 'Smash Ctrl-C to quit".

However, I noticed probably a bug. I used the simplest snippet:

from bottle import Bottle, run

app = Bottle()

@app.route(path='/')
@app.route(path='/<name>', method='GET')
def main(name=None):
    if name:
        return {'message': f"hello {name}"}
    else:
        return {'message': f"hello world"}

if __name__ == '__main__':
    run(app, host='127.0.0.1', port=5000, debug=True)

So, for this code during the runtime with turned on debug mode I change {'message': f"hello world"} to {'message': f"hello no world"} and the response is still {'message': "hello world"}. Whereas the logs are 127.0.0.1 - - [14/Feb/2024 14:25:58] "GET / HTTP/1.1" 200 26

Done list:

The issue still persists. Hope this information will be helpful for you. Good luck.

UPD:

import requests

print(requests.get('http://127.0.0.1:5000/').json())

Just tested with requests and the issue persists.

defnull commented 4 months ago

Debug mode does not enable code reloading on change, just more detailed error messages. See https://bottlepy.org/docs/dev/api.html#bottle.run You are looking for the reloader parameter?

codeawn commented 4 months ago

it should reloader=True