Tagged Questions
0
votes
0answers
12 views
SQLAlchemy generating query in loop with contains
I'm building a web app in Flask that involves some SQLAlchemy. I have a function "get_team()" that is driving me bonkers.
def get_team(playerlist)
cond = and_(*[Team.users.contains(p) ...
0
votes
0answers
10 views
Flask on Raspberry Pi changing standard page
On my RPi (b model) Flask is installed.
I can access the webpage "It works" via another browser on another computer.
Works great. As well on my LAN as from the outside world.
And also, I can write ...
1
vote
0answers
11 views
Exclude soft deleted items in self referential relationship SQLAlchemy
I currently have a self referential relationship on the Foo:
parent_id = DB.Column(DB.Integer, DB.ForeignKey('foo.id'))
parent = DB.relation(
'Foo',
remote_side=[id],
...
1
vote
3answers
21 views
socket.error: [Errno 13] Permission denied when creating a fake email server
I'm trying to create a fake email server as part of a Flask app to print out errors on the console by using the following script. However, it throws an error. How can I fix this?
...
0
votes
2answers
29 views
Python: ImportError while __init__.py exists
I have the file: run.py in C:/mycp/applicationl directory, which contains the following code:
from che import wserver
from applicationl import app
The directory: C:/mycp/applicationl also contains ...
0
votes
2answers
21 views
Can't access Postgres DB on Heroku app
I have a Python 2.7 / Flask app running on Heroku that scrapes data and I now want to store that information in a database.
I've tried to follow tutorials like this one and apply this to my case but ...
1
vote
1answer
26 views
php header('Refresh: 1;url=destination'); in Flask + python?
in php there is
header('Refresh: 1;url=destination');
which redirects the client to a given url, and while it must be called before anything else, it allows me to display something else after that ...
1
vote
1answer
16 views
Flask putting form into URL
I've been working on a form that sends data to a scraper and simultaneously generates a URL from form input. The returned templates works flawlessly, but the URL change ends up giving me the entire ...
-1
votes
0answers
19 views
Use Python Flask to call REST API [on hold]
I tried to use Flask and found it is a great framework to build web application.
I am going to use in the web application frontend project heavily accessing REST HTTP API implemented on Java and ...
0
votes
0answers
15 views
exclude flask model field
i have created an small admin interface for blog posts. in edit mode of articles i want to edit also the Question Model. Now it will show up in the edit mode but with 'created_at' field. how can i ...
0
votes
0answers
26 views
Declaring Blueprint in init file
I have a blueprint, let's called it dashboard. Assume I have the following structure:
/application
app.py
/dashboard
__init__.py
controller1.py
controller2.py
/templates
Right ...
0
votes
0answers
7 views
flask-admin form_override SelectField form_args from another view as an in-line model
I would like to retain the form_overrides SelectField using form_args from FirstView to be used as in inline_model into another view called SecondView. For instance:
class FirstView(ModelView):
...
0
votes
0answers
12 views
Can you have multiple instances of a WTForm?
I am implementing a commenting system (using Python/Flask/WTForms) on an internal application and it allows for Comments, and a single level of subcomments under each.
The Comments work fine with a ...
0
votes
1answer
19 views
Jinja2 to put a whole element in <option>
I need to dynamically select from the following:
So that I can show the selected element depending on POST request.
I want to templatize selected="selected" so that I can choose where to put.
...
0
votes
0answers
11 views
Self referential relationship is disappearing in flask-admin
Hope you can help me!
I have a relationship in sqlalchemy as follows:
class Location(db.Model, DateModified, Sluggable):
__tablename__ = 'location'
__sluggable__ = {
'populate_from': ...
0
votes
0answers
31 views
How to get Uber Python/Flask example to work
I'm trying to make a web app using the Uber api (https://developer.uber.com/v1/tutorials/).
In their tutorial they link to an example application on github with instructions to get it running. ...
0
votes
1answer
15 views
Flask-Restful 404 when api is started in __init__.py
I am using Twilio's flask.ext.restful extension with the following setup:
Top level folder is app
Inside of which is: ___init___.py:
from flask import Flask
from flask.ext import restful
# Basic ...
-2
votes
1answer
23 views
Alternative to gevent for python3?
What is a good alternative for gevent that is python3 compatible?
I am finding trouble finding any python3-compatible libraries to use on the python side. Any suggestions?
2
votes
1answer
23 views
Get POST values in Flask using `form`
Get POST values in Flask using form
I have this form in my HTML and I want to input values when user clicks Submit buttons.
<form method="POST">
<input id="my_input" type="text" value="{{ ...
1
vote
1answer
32 views
Flask sqlalchemy many-to-many insert data
Greetings,
I am trying to make a many to many relation here in Flask-SQLAlchemy, but it seems that I don't know how to fill the "many to many identifier database". Could you please help me ...
0
votes
1answer
24 views
How many Base or MetaData instances do you need in SQLAlchemy?
I'm currently reading the docs on SQLAlchemy for use in Flask and one thing that is very unclear to me is how many instances of certain SQLAlchemy objects (such as Base or MetaData) I need?
For ...
0
votes
2answers
27 views
How can you map multiple tables to one model?
If I have two tables with same columns, ex. a table called Toyota and a table called Honda,
how can I map these two tables with one model (maybe called Car) in flask?
0
votes
1answer
14 views
Flask SQLAlchemy db.create_all() not creating database
I can't seem to figure out why my call to db.create_all() is not working.
I have an app package with following init:
from flask import Flask
from config import config
from flask.ext.sqlalchemy ...
0
votes
1answer
26 views
Flask use SQL query at client side
I am doing a small project in Python / Flask.. My database model consists of two tables say post and comments.. Post table consists of the posts and the comments table consists of the comments for the ...
-1
votes
0answers
36 views
How to create flask form to get data dynamically from db and write back in db selected data only [on hold]
I want to create a form in flask such way that i can upload image and put name of image and select location of image from my db and then display all images from that place and can select some images ...
0
votes
1answer
15 views
Flask: Server becomes unresponsive after some time
I use a flask server to serve static files from a server but once in a while the server becomes completely unresponsive, downloading a file keeps loading but never downloads. When I opened up the ...
3
votes
1answer
37 views
How to run recurring task in the Python Flask framework?
I'm building a website which provides some information to the visitors. This information is aggregated in the background by polling a couple external APIs every 5 seconds. The way I have it working ...
-1
votes
1answer
30 views
How to generate encrypted url link in flask for image file [on hold]
i'm using flask and want to have blueprint like my code below. i want to generated encrypted url link return and imagefile display in web browser. i read itsdangerous module but have no idea how to ...
0
votes
1answer
28 views
Flask SQLAlchemy relationship
I have a pretty simple model in Flask and SQLAlchemy, with companies playing matches. A match is defined by a host and a guest. I don't know how to bring the host and the guest companies to the ...
-1
votes
1answer
32 views
How to JSON dump data to a Flask app route? [closed]
I am working on a webapp. I am running a python script and it collects some data now I want json dump of that data and pass it to a Flask webapp route. somthing like this route ...
0
votes
0answers
11 views
Testing flask.ext.restful url route resolution
I have some flask.ext.restful application code like
# Providers
api.add_resource(ProvidersListAPI, '/providers',
endpoint ='providers')
api.add_resource(ProvidersAPI, ...
0
votes
0answers
34 views
404 Not Found when trying to access Flask-Admin on uWSGI
i'm a newbie in web programming, so i'm expecting to be missing a super simple thing in my configuration, hoping you can help me! (Also forgive my english - heh)
So here's the thing:
I'm on my little ...
1
vote
1answer
20 views
Flask: Custom Error handler resulting in TypeError: isinstance() arg 2
I have an issue using Flask and creating a custom error handler. I want to offload my error handling to a separate class and have followed the documentation here: ...
0
votes
1answer
14 views
Flask Json Request 400 logging?
I wrote my own custom client which sends raw http requests via my wifi card to my flask webserver.
This is what a typical requests looks like:
Content-Length: 214
User-Agent: blah
Connection: close
...
3
votes
1answer
37 views
How to post data using requests module to a flask application?
I am trying to develop a small tiny application using flask and requests module. I tried to post some data to a flask web application. But I stuck at this error.
flask.py
@app.route('/add/', ...
0
votes
0answers
21 views
Flask restless operators not filtering properly
I'm developing a login for a mobile web app using Flask and Flask restless. For the moment I have only 1 record in my database for testing, when I send my AJAX request to Flask restless, it seems to ...
0
votes
2answers
48 views
Flask renders css file as empty
I've been working on a simple Flask app, and at some point decided to add custom CSS styling alongside Bootstrap. However, for some reason, this CSS file is rendered as empty file. Whether I open it ...
0
votes
2answers
45 views
Would I be missing anything or running into walls if I want to develop Django/Flask web apps in Windows? [closed]
I know that there are some issues with rails development under Windows and all the people are suggesting to switch to OS X/Ubuntu.
I run a company and I need to stick with Windows (7). I cannot ...
0
votes
1answer
27 views
How do I make this function redirect to a given html page?
I'm trying to write a simple script for an exercise I created using Flask, that calculates a tip amount from a meal value entered into a form.
The first function below (meal_total) takes the value ...
0
votes
1answer
27 views
Abort 404 not working in flask after request
I have a multi domain website with flask but I want to restrict access to all views and blueprints except those I allowed access to them in some domains. So I decided to use flask after request ...
-1
votes
0answers
33 views
How to get else statement to work properly for message elements in Flask
I'm having a issue that's kinda hard for me to explain properly. How would I get the success message to pop up when a email is sent without making the contact form disappear? I know I would just use ...
1
vote
1answer
37 views
Why can't I get the database lastrowid?
I want to record form data and pass it to the another page, so I was just going to pass it the (autoincrementing) row id and then retrieve it in the next function. It is properly creating the database ...
2
votes
1answer
26 views
How to enable CORS in flask and heroku
I am trying to make a cross origin request using jquery but it keeps being reject with the message
XMLHttpRequest cannot load http://... No 'Access-Control-Allow-Origin'
header is present on ...
0
votes
1answer
13 views
How do I directly reference a table column in a database relationship?
Ok, my google-fu fails me. I want to have 2 relationships specified in a single table. Specifically, in the code below, I want to have the User.written field reference directly to the ...
0
votes
0answers
18 views
Need help for Flask babel configuration
aI have a flask project and the folder structure is like below:
/myproject
/env
/project
/apps
/app1
/app2
...
/utils
__init__.py
config.py
babel.cfg
...
I don't ...
0
votes
1answer
14 views
Flash not working on redirect during unittest testing
I have an endpoint that does some logic and a flash()and then redirects to another endpoint, which adds another flash and displays both flashed messages. When I test the endpoint in my browser, I get ...
0
votes
0answers
17 views
How to protect from huge uploads in flask? [duplicate]
Originally my question was identical to the question asked here (I wanted to know how to check the size of the uploaded file "on-the-fly"). From the answers given on the linked page I got some ideas ...
0
votes
1answer
30 views
Why `request.files` is empty?
I am trying to follow this simple tutorial for file submissions in flask. To submit files I use the following HTML form:
<form action="" method="post" "enctype=multipart/form-data">
<table ...
0
votes
1answer
20 views
Flask import error
I have workspace and task blueprint in flask with workspace view workspace/apis.py and task view task/apis.py
I want to import Task class from Task model in workspace/apis.py but i can't.
workspace ...
-1
votes
1answer
26 views
IndentationError: unexpected indent when returning a variable after form submission
I'm new to Flask and started exploring with simple functionalities. The idea is to have a form with just one field and read this form data and pass it to another function to do something else. So for ...