Questions tagged [bottle]
Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.
1,478
questions
2
votes
1
answer
144
views
Python mypy type checking not working as expected
I'm new to python, and am a huge fan of static type checkers. I have some code that handles file uploads with the Bottle framework. See below.
def transcribe_upload(upload: FileUpload) -> ...
0
votes
0
answers
9
views
Mocking a request object in bottle for unit testing
I am writing some test for my webapp built using bottle framework. I am using boddle to mock a request object. In the documentation of boddle, both the test function(testWoot()) and actual method(woot(...
0
votes
0
answers
18
views
POST request with Bottle Python getting multiple values that are not input
<datalist id="hrana">
% for ime in hrana:
<option value="{{ime[0]}}">
%end
</datalist>
<div class="column&...
0
votes
0
answers
22
views
Multiple Sessions on Bottle Python
I have built an attendance system for a company based on the Bottle web framework. Working perfectly fine, but it is not allowing multiple sessions. i.e, I want to access the same local host on ...
0
votes
0
answers
58
views
Python Bottle Cart Response Cycle
Python Bottle framework form tutorials always dead end by spitting out raw text of data obtained from a POST method. But that’s not how web sites work. I want to cycle right back to the same HTML/URL ...
1
vote
2
answers
45
views
Check if a filename has multiple '.'/periods in it
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 ...
1
vote
0
answers
49
views
Python-Bottle internal Server Error 500 when uploading to S3 bucket and creating an PostgreSQL entry in RDS
so i explore the AWS at the moment and have a problem regarding an own little project.
I have a python bottle on an ec2-instance, a S3 bucket for uploads and a RDS instance (postgreSQL).
I have a ...
0
votes
0
answers
28
views
Using Bottle WSGI, there is an approx 1 minute delay in web transactions
I have a Python programm that shows statistics of equipments with the use of simple web pages and matplotlib charts in the form of images. Since a while and I can't relate to any event, there is a ...
0
votes
1
answer
47
views
Correct procedure to connect to a network database
I am making an application with qooxdoo, and I need to connect to a sqlite database. I am not able to.
A few years ago I made another application and I was able to connect, in that case it was mysql, ...
0
votes
0
answers
87
views
lxml.etree.XMLSyntaxError: Entity 'ograve' not defined, line 244, column 31 (Bottle Framework)
I am parsing a huge file(3.5gb) using lxml, the data of one child looks something like this :
<phdthesis mdate="2022-10-12" key="phd/it/Borga22">
<author>Piero Borga<...
1
vote
1
answer
292
views
How to pass health check tests on AWS App Runner while deploying Python Bottle server?
I suppose this is a pretty dumb questions but I'm really poor at devops.
I have a small Python programming project which I need to deploy on the web. It's not a real app, just a small script which I ...
0
votes
0
answers
103
views
Redirect Python Bottle stderr stdout to "logging" logger (or more generally using any WSGI server)
By default, Python Bottle with WSGIRefServer logs the uncaught exceptions to stderr (and stdout for requests logging).
I'd like to log uncaught exceptions to a logging logger object. The following ...
0
votes
1
answer
21
views
Any values taken from a Listbox return as "none" in bottle
I have a website in which you take values inputted from a website (using bottle) and add them to a database (using sqlalchemy). The data gathered for "Status" needs very specific strings ...
0
votes
1
answer
42
views
what does '%%' do in multiline strings? [duplicate]
I was messing around with the modules in my site-packages folder when I found a Python file: bottle.py.
From what I can read, it is used for small web applications.
I was curious to read its source so ...
0
votes
1
answer
25
views
Change Python botlle server routes ordering
I have the follwoing route:
@app.route('/<path:path>', method=['POST', 'GET'])
How can I access change route ordering to access this route if it placed below
@app.route('/helllo/<path:path&...
0
votes
0
answers
52
views
Bottle static file and download it to the browser with JS
I have a file that I want the user to download with his browser.
I am using backend of Bottle:
file = stdout.decode("utf-8")[stdout.decode("utf-8").rindex('/') + 1:stdout.decode(&...
3
votes
1
answer
200
views
Raspberry pi refusing connection to bottle server
I'm trying to host a bottle server on my raspberry pi (4, zero w or zero 2 with newest pi os) to supply some configuration for a project.
The raspberry pi itself will not have internet access but will ...
0
votes
1
answer
39
views
Replacing <ul> with For-loops, and failing miserably
I'm trying to crate a webpage and decided to make a For-loop instead of using ul. I am using bottle and can't figure out why this code doesn't work.
<%
titles = ["Home", "Tutorial&...
1
vote
1
answer
47
views
JavaScript-HTLM validation form not working properly. Python-bottle
I want to check if the email adress is already in my database using onfocusout in html. If the email adress exists then the messages shows me that the email exists when clicking out but when I rewrite ...
0
votes
1
answer
81
views
Python-Bottle restrict the user from writing an URL on the browser and skipping previous page
I have two routes, the first one collects two variables that will be shown in the second route (template) by clicking submit. But if I write the URL from the second one (/viewtrips) on the browser ...
0
votes
1
answer
38
views
Python-Bottle, form is too big in the main app.py
I'm new to programming and I am doing a Webbapp with bottle. I'm doing the request part right now but my tutor told me is quite messy. How can I improve or make @route cleaner? My code:
'''
from ...
0
votes
1
answer
104
views
How to loop and display MySQL dates into FullCalendar
I am using python with bottle framework and JavaScript, and I want to display fetched MySQL dates into FullCalender. I am successfully fetching the data from MySQL, as shown below, but the problem is ...
0
votes
1
answer
42
views
Using bottle cork as authentication with mongodb not working in python 3.10
I am using bottle cork as authentication and working in python 2.7 but on python 3.10 its not working
Here is the code for login
@bottle.post('/login')
def login():
"""...
0
votes
0
answers
131
views
GET data with foreign key from a SQLite database as nested JSON
I am trying to GET data from a SQLite database as nested JSON.
I have two tables patient and journal. Journal has a foreign key to the CPR column in patients.
I have the bottle functions to GET the ...
2
votes
2
answers
1k
views
uwsgi PY_SSIZE_T_CLEAN macro must be defined for '#' formats
I have uwsgi==2.0.20 and python[CPython 3.10.4]. And I can't execute the following code:
uwsgi.cache_get(key, 'mycache')
Error:
PY_SSIZE_T_CLEAN macro must be defined for '#' formats.
Is there any ...
2
votes
1
answer
60
views
Unable to load correct page in Bottle Python
i'm having a hard time understanding why i can't load the "/ticket" page properly, but i can load the "/" fine. I should have the /ticket page running and able to type the ...
0
votes
1
answer
45
views
How to pass the result of a python function to the html page where the action button was clicked (python bottle)
I have method:
@post('/home', method='post')
def myFunction():
if(len(request.forms.get('Matrix_dimension').strip()) != 0):
length = int(request.forms.get('Matrix_dimension').strip())
...
0
votes
1
answer
60
views
Bottle.py | request.forms.get() returning NoneType using AJAX
I am trying to send javaScript information into a bottle.py server using AJAX. After trying nearly every solution I could find on stackOverflow, bottle docs, or Google in general. No solutions have ...
1
vote
0
answers
17
views
Bottle - Backend testing
I am trying to test my backend functionality for my Bottle app. More specifically, I am interested in unit testing.
Is there any tool that can be used for this? Does Bottle provide any own unit ...
0
votes
1
answer
74
views
How do I detect if a visitor is on a mobile browser with bottle.py?
I'm a beginner at bottle.py, and I'm trying to make a website where the HTML is changed based on if the visitor is on a PC or mobile device. How could I achieve this?
-1
votes
1
answer
213
views
Why does my bottle server fail at startup?
I have written a little server using python and bottle and a systemd unit to install it as a service on xubuntu. The python script works as intended, and the service works fine if I start it from the ...
0
votes
1
answer
125
views
How to get elements from a nested dictionary that has the same value using python and bottle framework?
I am working with bottle framework in python, and I have created a dynamic @get route that gets all tweets with the same user_id based on the ID from the URL
Below is my nested tweets dictionary and ...
-1
votes
1
answer
42
views
Firefox or Chrome can't find a photo inserted in a Bottle template
I am old timer but young learner. I want make my own website, using Python and Bottle.
I have an HTML page which contains a title, a subtitle and a photo. This is a template used by Bottle in this ...
1
vote
1
answer
117
views
How to handle a put request from the html form using bottle framework
I am using bottle, and I want to handle a put request from HTML and update a nested dictionary. I know I can do front-end validation but I am currently working on an assignment where this is a ...
1
vote
1
answer
186
views
Update a dictionary of item in Python using bottle framework
I am doing crud rest API in Python with bottle framework and I am having trouble updating an item by id in a dictionary. So far I have done create, read, and delete.
Here is my dictionary:
items = [
...
0
votes
1
answer
55
views
Picture not showing bottle.py
My picture isnt showing, I tryed copying code and that didnt work. I want to be able to do this, what am i doing wrong?
my code
from bottle import route, run,Response,template
from bottle import *
...
1
vote
1
answer
242
views
Is there a way to create an HTML table from a list using bottle
I'm using os.listdir to get a list of subdirectories and want to display them as a table on a webpage. I'm using bottle for the web framework. I have seen in the bottle documentation that it can be ...
0
votes
1
answer
366
views
value of checkbox python bottle
I am trying to retrieve the labels (or values) of the checkboxes that the user has selected and return them to a different page. This logic is working for text entries, select options, and radios, all ...
0
votes
2
answers
350
views
Working outside of request context Error while trying to submit a form, using BottlePy
I'm learning Python and trying to send an email with Python from a simple HTML form. The main problem is submitting the form, because smtp mail settings are 100% alright.
Here is my Python code:
@post(...
1
vote
1
answer
225
views
POST method 405 and 404 errors in bottle
I am very very new to Python and Bottle and how server requests/responses work, and there are still quite a few basic and general ideas that I am trying to wrap my head around. That being said, there'...
0
votes
2
answers
91
views
Python Bottle is None from React JSON
I have this in React:
const payload = {
x : x,
y : y
}
fetch("http://localhost:8080/update_game", {
method: "POST",
body: JSON.stringify(payload)})
And this in ...
2
votes
1
answer
70
views
Passing a list to a bottle template, then using this list in a <script></script>
I'm using bottle for a very simple one-page website. In my route for '/', I have something like this:
@app.route('/')
def index():
data = [['A', 1], ['B', 2], ['C', 3]]
return template('index....
0
votes
1
answer
97
views
How can I display textarea client input on website without changing URL?
I am attempting to implement a feature on my website, where a user can input a comment into a textarea and have it display the comment, below the comment box. For backend I am using bottle. At the ...
1
vote
1
answer
48
views
Redirect all non-www requests to www in bottle-py
I want to issue a 301 redirect for all requests with a host different than the one identified as canonical.
Something like the following, without replicating it in every route:
CANONICAL_HOST = 'www....
1
vote
1
answer
70
views
Check if DEBUG in python Bottle
I'm using Bottle 0.12,
how to use the DEBUG global to check if I'm running the development server — or another mean to check in the app if app.run(debug=True) is running?
What I want to achieve is to ...
1
vote
1
answer
257
views
python bottle handle single and multiple onclick button operation
How do i trigger an operation if a button is clicked for the first time , but if pressed again do extra thing.
This is in text first a description of what i aiming to achieve, I'll provide a little ...
1
vote
3
answers
175
views
displaying images properly and javascript
ok so, I have a website that I want to put all of my photos on, and so far I have a portrait section, however, it doesn't display properly, I want it in rows just so it looks neat and tidy, and also ...
0
votes
1
answer
51
views
pybottle gunicorn gevent not sharing global dict
from gevent import monkey
monkey.patch_all()
import bottle
app = bottle.Bottle()
COUNT = 0
@app.route('/inc', method='GET')
def count():
global COUNT
COUNT += 1
return COUNT
def main():...
0
votes
0
answers
226
views
TypeError("'AssetId' is an invalid keyword argument for Assets")
I have no clue what I did wrong as it was working completely fine earlier, I haven't changed anything within the code but the error 'TypeError("'AssetId' is an invalid keyword argument for Assets&...
0
votes
1
answer
38
views
xgettext fails to extract tag attributes
I'm stuck with xgettext missing tag attributes in HTML templates, e.g.:
xgettext --keyword=_ --language=Python -o - - <<EOF
<!DOCTYPE html>
<html>
<head>
% msg = _('A ...