1
vote
0answers
15 views

Flask-SQLALchemy Unit Test Problems

I'm writing a web app by imitating The Flask Mega-Tutorial. As I was trying to add some unit test cases to my code. I found that the test cases in the Tutorial had many duplicated codes. Here is the ...
0
votes
0answers
17 views

MongoDB Replica-Set: ConnectionError on Failover in Flask App

I have a three node MongoDB replicaset and just tried to initiate a fail over (shutdown the primary). If I login to one of the two remaining nodes, I can see it is now elected PRIMARY - good. ...
0
votes
0answers
32 views

Flask + sqlalchemy - NameError: global name 'string is not defined

Cannot figure out why this exception is being thrown only sometimes - maybe one in five attempts. I have a simple API that accepts a file, stores it, and logs some metadata in a postgres database. ...
0
votes
0answers
12 views

Peewee Foreignkeyfield doesn't accept appropriate foreign key field

I'm using the Python Peewee ORM in my flask app as a database. I've got a user defined and a ticket as follows: class Ticket(db.Model): created = DateTimeField(default=datetime.utcnow) ...
-1
votes
1answer
35 views

404 Error Not Found

I am new to flask and twilio and I am getting a 404 error running my app (I am following this tutorial: https://www.twilio.com/blog/2012/01/making-an-sms-birthday-card-with-python-and-flask.html) . I ...
0
votes
0answers
22 views

Python/Flask - What is the better approach to cache external API data? [on hold]

I'm developing an application that makes a request to an external API, and uses json data received to work. I don't need this data updated frequently, once a day is more than sufficient to me. I'm ...
0
votes
0answers
24 views

Flask / Jinja: Error while passing list of strings

I am working with the following template, titled template.html, taken from https://realpython.com/blog/python/primer-on-jinja-templating/ <div class="container"> <p>My string: ...
0
votes
1answer
17 views

SQLAlchemy find all rows with existing relationship

I have an uploads table and upload_files table. With models Upload and UploadFiles. The upload_files has an upload_id field. And the upload model has a relationship set up to UploadFiles. What I am ...
0
votes
1answer
15 views

Upload audio file to Parse REST API via Flask

I am trying to upload an audio recording to Parse via their REST API. I am uploading the blob to my Flask app and then converting that file to a base64 string to be sent to Parse. The response from ...
0
votes
1answer
28 views

No module named flask.ext.wtf.SelectField

I found flask-jquery-ajax-example and I tried to run it with the latest library versions: $ pip install flask flask-wtf wtforms $ pip install -e ./ However, I got the ImportError: No module named ...
0
votes
1answer
34 views

Removing a column from a DictField in MongoDB [Flask + MongoEngine]

I need to remove a particular column (in this case "Paper ID") from a DictField (in this case "content") in all documents. The corresponding mongo-shell script for the same is ...
2
votes
1answer
27 views

what is a good way to pretty print a SQLAlchemy database as models and relations?

This one might be a challenge, but I am trying to find a nice way to get an overarching idea of how my entire database "looks". Here is a small example using Flask-SQLAlchemy, a few models with ...
0
votes
1answer
17 views

I cant deploy my flask app on heroku

Im new on heroku and im trying to deploy my app there. But it fails and i receive the following message: Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__ ...
0
votes
0answers
16 views

Boto S3 takes 15 seconds to connect

Hi im using Flask with Boto (S3). Each time i try to view images from the bucket i do this: if hasattr(self, 'bucket_cache'): return self.bucket_cache b = ...
0
votes
1answer
22 views

Flask jsonify returns weird array?

I'm trying to create a simple API using Flask. I now want to return a list of dicts as follows: print results # prints out [{'date': '2014-09-25 19:00:00', 'title': u'Some Title'}] response = ...
0
votes
1answer
14 views

Any way to extend request timeout limit?

I am getting [2] [CRITICAL] WORKER TIMEOUT at=error code=H12 desc="Request timeout" method=POST dyno=web.1 connect=1ms service=30000ms I am starting a flask web app on heroku with web: gunicorn ...
0
votes
0answers
20 views

Flask secret key and session variables

I have a Flask app that receives a token from an outside service after the login is successful, so imagine my app /login redirects to an outside service, which returns to /auth with a token which is ...
1
vote
2answers
21 views

Javascript not rendering correctly in Flask jinja2 templates

I'm writing a Flask app using jinja2, and I'm trying to pass my Python variables both into some Javascript and HTML. I made Javascript and HTML templates, but for some reason the Javascript is getting ...
0
votes
0answers
28 views

How to keep track of user once he/she logs in (Flask)

I created two simple views on my website. In the first one the user logs in and I set the session to 'logged_in': @app.route('/', methods=['GET', 'POST']) def login(): error = None if ...
1
vote
2answers
21 views

Flask and/or Tornado - handling time consuming call to external webservice

I've got a flask app that connects with given URL to external services (with different, but usually long response times) and searches for some stuff there. After that there's some CPU heavy operations ...
-1
votes
2answers
28 views

How can I set the user's ip as column default?

When a user is registered, I want to record their ip address. How do I access the current ip and set it as the column default? regi_ip = db.Column(db.String(24), default='???')
1
vote
1answer
22 views

Flask JSON serializable error because of flask babel

I am using https://pythonhosted.org/Flask-Babel/ extention for localization. base form class #!/usr/bin/env python # -*- coding: utf-8 -*- from app import app from flask.ext.wtf import Form class ...
0
votes
1answer
33 views

How to create an API with a “remember me” function in Flask?

I'm going to build an API in Flask for a (to be created) app which will be built using PhoneGap. In the API many calls will need authentication. To get into the topic I was reading this tutorial on ...
0
votes
1answer
21 views

Encoding binary data in flask/jinja2

Hello I'm developing small app in python using flask, jinja2, sqlalchemy,... I'm saving binare data in my database: file = request.files['file'] # store the recipe recipe = Recipe(None, ...
0
votes
0answers
35 views

WTForms define one of many specific field by logic in __init__() of form

I have a few custom SelectFields. And I would like to use one of them according to some logic. For example: # in view @app.route('/some/<int:a>/', methods=['POST', 'GET']) def f(a): form = ...
0
votes
0answers
23 views

how do i configure python/flask for public access with windows firewall

We have developed an app in python and are using flask to expose its api via http requests. all this on WINDOWS - Everything works ok and we have tested in-house with no problems and we are now ...
0
votes
1answer
17 views

send_static_file not picking up from static folder at root in Blueprint

From the views.py inside my blueprint, im trying to use the send_static_file to deliver an index.html and just cant get it to work I have a blueprint called main which I initialize as such in the ...
0
votes
1answer
19 views

bootstrap-select with flask

I tried to used bootstrap-select whith the following example, but in Flask I get only one value and not the maximum two values? <form class="form-horizontal" action="{{url_for('compare')}}" ...
0
votes
1answer
31 views

How to build a account validation system with flask and mongoengine

I'm learning Flask by reading the book http://flaskbook.com/# (some of the code I posted below is been taken from the examples in the book) but I want to use mongodb as database so I use the ...
-1
votes
1answer
31 views

Python HATEOAS using a micro framework like eve that runs on top of sqlalchemy [closed]

The eve project in python is by far the easiest way to create RESTful applications with links for me. It's been using mongo in the background and I reckon there are few attempts at making use of ...
0
votes
1answer
16 views

get multiple variables from form with websockets in python

Just starting to learn websockets and python. for now I am using Socket-IO and have the very basic 'pull from form and echo it back out' but I need to be able to pull in 2+ variables from the form ...
0
votes
0answers
26 views

sqlalchemy: compare datetime field with string?

I have a string contains date like '2014-09-28' and want to search through model like following: Log.query.filter(Log.created_at >= from_date) For a record which has datetime.datetime(2014, 9, ...
1
vote
1answer
27 views

When using a flask application does using print negatively affect performance?

I've deployed an flask app on heroku and since it's relatively small I never bothered to setup the logger. I have found by using a print statement I can see everything I need on one of herokus add-on ...
0
votes
1answer
16 views

flask session not reloading

Right now I am using Flask and a flask 3rd party library Flask-Session Using the code below, I reload the page 4 times and get the following output: set userid[0] 127.0.0.1 - - [27/Sep/2014 ...
0
votes
2answers
17 views

secret key not set in flask session

I am having 0 luck getting a session working in Flask (a Python module). Right now I am using a flask 3rd party library Flask-Session When I connect to my site, I get the following error: ...
2
votes
1answer
25 views

Flask, how to return a success status code for ajax call

On the server-side, I am just printing out the json-as-dictionary to the console @app.route('/',methods=['GET','POST']) @login_required def index(): if request.method == "POST": print ...
1
vote
2answers
45 views

Flask request.form.get returning None

I am new to flask and am trying to learn. I am trying to access information from the query string. Here is my html code (simplestuff.html, it is in the templates folder): <!DOCTYPE html> ...
0
votes
1answer
16 views

Flask - got multiple values for keyword argument 'eventid' - Decorators

I'm currently running a Python Flask application that makes use of the following decorator: def login_required(fn): @wraps(fn) def wrapper(*args, **kwargs): if 'phone' in session: ...
0
votes
0answers
31 views

Where to sanitize data when using multi-purpose api [closed]

I am building a multipurpose api(multipurpose as in used for AngularJS webpage, Android App, + possible more technologies) in Python Flask with Pymongo. I have discussed lot with my fellow colleagues ...
0
votes
1answer
18 views

Strange TypeError when migrating database

After migrating my database a few times, I began to see this error appear on my local server. If I clear the database and re-create it, there is no error, so I don't think there is anything wrong ...
0
votes
1answer
28 views

Calling javascript from html button

A quick summary of what I am trying to do. I am trying to make a webpage that receives a list from my python server using flask. It then adds each element of the list with a checkbox form. After that ...
1
vote
2answers
46 views

Decoding base64 from POST to use in PIL

I'm making a simple API in Flask that accepts an image encoded in base64, then decodes it for further processing using Pillow. I've looked at some examples (1, 2, 3), and I think I get the gist of ...
0
votes
1answer
26 views

Dynamically update image using Python Flask AJAX

I have 1 very simple web application I am building right now but am very new to flask and jinja (and web development as a whole actually). I have a watch folder, which will be getting an image sent ...
0
votes
2answers
32 views

Highcharts is not displaying in the div at all, resulting in a blank page - Using python flask and jinja template?

Here is my index.html file. I have included the scripts in the correct order. I try to load the div with the dummy graph. I have tried including the scripts in base.html but nothing works. I had the ...
1
vote
2answers
25 views

flask - how to get parameters from a JSON GET request

I have a client side api that issues the following GET request: "GET ...
0
votes
0answers
10 views

Delegate request from one flask app to another one (on different machines)

I have a VPN Network with many machines, all running an apache2 wich a flask web app in the background. I want now somethink like a master flask app on a server. So you connect to this server and ...
0
votes
0answers
16 views

Mongengine - Get Cursor instead of Documents

I am using mongoengine for querying the mongodb instance. The task requires for me to iterate through an entire collection. The collection contains half a million documents and is thus causing a ...
0
votes
1answer
25 views

Flask helper classes and return values

Greetings, I am working with Flask and trying to create some helper classes instead of doing the data logic in the "controllers"/"routes", but my problem is that it doesn't seem to return anything ...
0
votes
1answer
14 views

Flask configuration paths

So I have this code in my init: app = Flask(__name__) app.config.from_object('config') app.config.from_pyfile('app.cfg') My folder structure goes like this: /config.py /app.cfg /app/__init__.py ...
0
votes
0answers
12 views

Debugging JavaScript with Flask and PyCharm

I just installed the professional version of PyCharm for its Flask features, but I'm having a lot of issues getting anything JavaScript related working. Firstly, is there any way of getting the ...