In all of my view functions if i 'methods=['POST'] for example:
@app.route( '/file', methods=['POST'] )
i receive the error:
Error: 405 Method Not Allowed
Sorry, the requested URL 'http://superhost.gr/downloads/file' caused an error:
Why Bottle gives me this error message?
I'd guess you get error when trying to get the view (GET). And that is result of your only allowing POST.
You should have
@app.route( '/file', method=['POST', 'GET'] )
or a separate handler
@app.route( '/file', method=['GET'] )
Update: looks like there was a typo in your example that I copied over. 'methods' should be 'method'.
Update2: Below is a working example:
from bottle import Bottle, run
app = Bottle()
@app.route('/file', method=['GET', 'POST'])
def file():
return "Hello!"
run(app, host='localhost', port=8080)