bottle

bottle / gunicorn not responding to SIGTERM after ANY request

bottle / gunicorn not responding to SIGTERM after ANY request Question: I have used bottle for a long time and never run into this before, but recently I started a new project and encountered some strange behaviour that I just can not track down at all. If I start a bottle instance in my script, …

Total answers: 1

Check if a filename has multiple '.'/periods in it

Check if a filename has multiple '.'/periods in it Question: So I’m making a website and in one of the pages you can upload images. I didn’t think of this before when making my file upload function but files are allowed to have multiple . in them, so how can I differentiate between the "real" …

Total answers: 2

bottle + CGI always matches / route

bottle + CGI always matches / route Question: I can’t get bottle to match any other route than “/” when deploying in a CGI environment. (I’m stuck with the hosting provider, FastCGI or WSGI are not on offer, unfortunately). Bottle lives in a subdirectory lib – I have dropped the bottle.py from bottle-0.12.18.tar.gz there. Python …

Total answers: 2

Trouble using bottle-jwt decorator (not works)

Trouble using bottle-jwt decorator (not works) Question: Having some trouble using this plugin https://github.com/agile4you/bottle-jwt/ It seems to not work as I expected, down below my code: import bottle from Py.engine import * from bottle_jwt import (JWTProviderPlugin, jwt_auth_required) class AuthBackend(object): user = {‘id’: 1237832, ‘username’: ‘pav’, ‘password’: ‘123’, ‘data’: {‘sex’: ‘male’, ‘active’: True}} def authenticate_user(self, username, …

Total answers: 1

python bottle always logs to console, no logging to file

python bottle always logs to console, no logging to file Question: In a python project with multiple threads my logging works well to write to a logger file. Basically based on Logging, StreamHandler and standard streams Part of my project is a bottle web server which runs well also. But every bottle call writes a …

Total answers: 4

Is there a way to log python print statements in gunicorn?

Is there a way to log python print statements in gunicorn? Question: With my Procfile like this: web: gunicorn app:app –bind "$HOST:$PORT" –error-logfile "-" –enable-stdio-inheritance –reload –log-level "debug" is it in any way possible to get python print statements to be logged to stdout / bash? I am using the bottle framework here as well, …

Total answers: 6

Python bottle requests and unicode

Python bottle requests and unicode Question: I’m building a small RESTful API with bottle in python and am currently experiencing an issue with character encodings when working with the request object. Hitting up http://server.com/api?q=äöü and looking at request.query[‘q’] on the server gets me “äöü”, which is obviously not what I’m looking for. Same goes for …

Total answers: 3

How to add a delay to supervised process in supervisor – linux

How to add a delay to supervised process in supervisor – linux Question: I added a bottle server that uses python’s cassandra library, but it exits with this error: Bottle FATAL Exited too quickly (process log may have details) log shows this: File “/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py”, line 1765, in _reconnect_internal raise NoHostAvailable(“Unable to connect to any servers”, …

Total answers: 3

ImportError: No module named 'bottle' – PyCharm

ImportError: No module named 'bottle' in PyCharm Question: I installed bottle on Python 3.4 with pip install. In the terminal, when I do: $ python3.4 >>>import bottle # shows no import error >>> but when I do it in PyCharm, it says: import bottle ImportError: No module named ‘bottle’ Asked By: Tinno TL || Source …

Total answers: 9

bottle convert post request to unicode

bottle convert post request to unicode Question: I have a server as app and all works ok except when I save ajax forms. If I save from python script – with right input – data are returned as unicode. But the data from js is strange: on pipe should be only bytes(that’s the only data …

Total answers: 2