Tagged Questions
-3
votes
1answer
29 views
IDE for python to understand code execution [on hold]
I would like to know is there any IDE which can help in understanding the codes and sequence of its execution in python (flask)?? something like showed here when you press the "step" button:
...
0
votes
1answer
16 views
Flask pagination example wont work missing “iter_pages”
I am working on a small web app to view some logfiles. But the
queries I issue to the database use to get very big.
I wanted to implement some pagination following this example pagination.
I put the ...
0
votes
1answer
19 views
Flask get 'next' parameters for a 'POST' request
There is a login function which accepts the data from a POST request. But in this case the "next" query parameter is ignored. What is the alternative for accessing the "next" query parameter other ...
0
votes
1answer
23 views
Twitter Photo Card Pulling
I'm trying to make a Twitter Photo Card which uses HTML meta Tags.
The first problem is, the tag looks something like this
<meta property="twitter:image" id="photo" ...
-4
votes
0answers
16 views
Rendering sql output on web with sqlalchemy engine on flask
I have an application built on Python-Flask framework. What I am trying to do is display a sql table output on a page of my website and i do this by connecting SQLAlchemy to an external populated ...
0
votes
0answers
16 views
Get last record of a day using joins in Flask-SQLAlchemy
I have a table of data given timestamps and a couple of values where I want to get the last value of each day.
In raw SQL I would do it like this:
SELECT strftime('%Y-%m-%d', a1.created_at) AS ...
0
votes
0answers
10 views
Flask-Social Twitter login fails with message - OAuthException: Failed to generate request token
I can't get either Facebook or Twitter login to work using Flask-Social (https://pythonhosted.org/Flask-Social/), following the example here: http://flask-social-example.herokuapp.com/
Focusing on ...
1
vote
1answer
38 views
request.args.get('key') gives NULL - Flask
I am trying to pass the variable 'email' from the 'signup' method in my view to the 'character' method. However,
request.args.get('email')
is saving NULL into the database. I cannot figure out ...
0
votes
1answer
20 views
Subclass Python class with same decorators
I'm using Flask-Classy to write a Flask app using class based views.
My base class is called SlugView. It catches URLs like example.com/124/catchy-article-name:
class SlugView(FlaskView):
...
0
votes
1answer
10 views
WTForms SelectMultipleFields dynamic defaults
I am using WTForms with Flask, (not Flask-wtf).
I am using the SelectMultipleFields where I set choices dynamically;
class MyForm(Form):
country = SelectMultipleField("Country", ...
0
votes
2answers
17 views
How to get CherryPy to listen only on a specific host
I have a flask app that I want to deploy using CherryPy's built in server. I chose CherryPy so that the app can be deployed without having to reverse proxy (ie. nginx in front).
I'm having trouble ...
-3
votes
0answers
19 views
Flask error while inserting User id to database
Application link given below..
I have been trying to create a simple blog application, that enables user to write, edit and delete posts and comments.. So far, I have done the front-end stuff and ...
0
votes
1answer
21 views
Flask-SQLAlchemy Abstract Base Model
In my Flask-SQLAlchemy App I want to add a few fields (created(by|on), changed(by|on)) to every Model/Table
my code right now
from .. import db
class Brand(db.Model):
__tablename__ = ...
0
votes
0answers
18 views
creating apache server with flask: the config
I am making a website, and need to host it as a webserver, using Apache2 running on linux. I am using a flask script, and I have created all the python code, with templates etc. But to configure flask ...
0
votes
3answers
60 views
Python, Flask, 'Hello World': No browser reaction
I have pip-installed Flask and HTML5 on my Window-system. When I start the Hello World!-program with IDLE, I get a red message in the Python-Shell:
"* Running on xxxx://127.0.0.1:5000/". (xxxx = ...
0
votes
1answer
23 views
Flask-HTTPAuth verify_password
I am stuck on flask-httpauth's verify_password.
I have username and password script that hashes the password and puts it into a simple file. (Yes not the most secure but LDAP/LOGIN doesn't work ...
0
votes
2answers
22 views
Flask url not found
i created a robots.txt , i've looking for how to include it in mywebsite.com/robots.txt and i found Flask
This is my code
from flask import Flask, request, send_from_directory
app = Flask('maksc', ...
1
vote
1answer
25 views
Python33, Flask: Lot of Errors starting Hello World
I just have installed with pip flask and HTML5 on my window-sytem. When I start the Hello World!-program with IDLE I get the text correct in a new tab of Firefox. But also a lot of error-messages in ...
0
votes
1answer
25 views
Is it possible to limit Flask POST data size on a per-route basis?
I am aware it is possible to set an overall limit on request size in Flask with:
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
BUT I want to ensure that one specific route will not accept ...
0
votes
2answers
26 views
use a css stylesheet on a jinja2 template
I am making a website using html, css, flask and jinja2.
I have a page working on a flask server, the buttons and labels etc. are displayed, but the css stylesheet I have is not loaded in.
How would ...
0
votes
2answers
26 views
Flask Value error view function did not return a response
Error message:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File ...
0
votes
1answer
19 views
How to return multiple models/tables flask-sqlalchemy?
I want to get data from multiple tables so I did this with sqlalchemy:
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
a = db.aliased(Employee, name='Employee')
b = db.aliased(Person, ...
0
votes
1answer
18 views
flask jquery ajax call that is executing on every loop
I want to iterate over files in a folder and and render links that execute a file from a flask interface.
The html/js I wrote executes the file selected by the user as many times as there are files ...
0
votes
1answer
19 views
Modify Flask-SQLAlchemy query result
I want to modify the results from a flask-sqlalchemy query by before sending them to render_template().
The view queries and modifies the items:
items = Items.query
for i in items:
date = ...
-1
votes
1answer
23 views
Run Python Script in Flask
I am new to Flask, and have a very basic website up.
The goal is to create a program (run locally) that streams tweets from specific users. A button next to the post - if clicked it will favorite the ...
4
votes
1answer
73 views
Isolation level with Flask-SQLAlchemy
I'm having trouble understanding how database isolation levels work with Flask-SQLAlchemy, and especially how to really commit changes or close a session. Here is the context of my problem :
I'm ...
0
votes
1answer
28 views
Python - how to programmatically generate Index.HTML file to list contents of an uploads folder?
I got a web service that allows user to upload files to the "Uploads" folder. These files are accessible by name using the /uploads/filename.ext path. However, unless I know the precise filename, I ...
0
votes
2answers
33 views
Why add self instead of self.last_seen in sqlalchemy db (Flask)
In this code the last_seen field is being refreshed with the current time whenever the user uses the site. However, in the call to the db, he (Minuel Grindberg "Flask Web Development") adds self ...
0
votes
1answer
29 views
issue with dates and flask-restful
I'm trying to get flask-restful to return a datetime field, however it fais with the error:
MarshallingException: 'datetime.date' object has no attribute 'utctimetuple'
The model(sqlalchemy) is ...
0
votes
1answer
26 views
jinja2 loop for flask ajax call to restart servers
I want to use ajax to restart servers from a flask web app.
My solution
Iterate over a folder of .bat files that restart servers, and send the name of the file to a flask function.
In my html, I'm ...
0
votes
2answers
31 views
Trouble Using JavaScript to Insert HTML Img Tag
I'm using the following code:
var oDiv = document.createElement ("DIV");
oDiv.innerHTML='<img src="{{ url_for(\'static\', filename=\'images/bubble4.png\') }}">'
to try and insert an image ...
1
vote
1answer
30 views
Are Python flask order of routes defined?
I have a setup similar to the below in my views:
@app.route("/test")
def test():
...
@app.route("/<to>")
def page(to):
...
It seems that function test in the example always will be ...
1
vote
0answers
15 views
How to integrate curl.js with server-side jinja2 templating
I have a Python-based Flask web application that uses Jinja2 to perform templating on the server-side.
I would like to improve my Javascript and CSS loading by using curl.js to load JS and CSS ...
1
vote
1answer
15 views
Jinja 2 markups showing when i try to use apache with a flask python coded webpage
The website is accessible by other computers by inputting the ip address of the host computer.
However, the jinja2 markups are shown.
Jinja2 markups image
And the links which use url_for do not work ...
0
votes
2answers
28 views
Flask-SQLAlchemy Constructor Confusion
Once again this code is from Miguel Grindberg's book "Flask Web Development". In models.py we have 3 classes, a Role class which has 3 roles (User, Moderator, Administrator), a User class (id, ...
0
votes
0answers
26 views
Application-scope variables in Flask
In Flask, within create_app, I'm declaring a few blank lists.
def create_app(settings_key='dev'):
veggies = []
fruit = []
I tried updating those lists like this:
def ...
0
votes
1answer
30 views
Dictionary get method not working with a received request data
What I'm trying to do is that from a textbox send a value to the server. Then search this value in a dictionary and place the result in a div. For example if my dict is d = {'a': "1", 'b': "2", 'c': ...
0
votes
0answers
14 views
Transfer csv of data locally to heroku with Flask
I have about a 4mb csv with 40,000 rows in it. I'm using this file locally to load in the data to my javascript. (See code below)
d3.csv("static/aggedWeather.csv", (data) ->
#d.Date = ...
0
votes
0answers
19 views
Python how to upload file to webservice using Flask module?
I'm following this tutorial on how to set up file uploading webservice using Flask. Below is a snipped of my code. I can see that the def upload_file(): gets the correct filename and allows it ...
0
votes
0answers
21 views
Flask render_template won't work on Heroku
EDIT:
I think it might be related to the comments posted here
Let me also add that I did not push this up in a virtualenv because I have anaconda installed for Ipython and supposedly those don't play ...
2
votes
1answer
27 views
python module import conundrum (module from submodule)
I have the following project structure:
./app/__init__.py
./app/main/__init__.py
./app/main/views.py
./app/models.py
./app/resources/__init__.py
./app/resources/changesAPI.py
./config.py
./manage.py
...
0
votes
2answers
18 views
jinja2 how to remove microsecond in datetime
In a Jinja2 template I want to display the last login:
Last Login: {{ user.last_seen }}
last_seen is supposed to be a datetime object in sqlite.
It always gives me something like: 2014-07-27 ...
0
votes
0answers
18 views
How can i make branch-shaped chart (python-flask) [on hold]
I'm making a webapp via python-flask.
and i'm trying to make branch-shaped chart graph. its structure will be similar to branch in git. I'v searched some and found something like SVG, cherryPy and ...
1
vote
1answer
22 views
List URL Route Flask
I have a list
imageIds = ["zw8SeIUW", "f28BYZ"]
which is constantly being added added to. I want to be able to access my site at /images/zw8SeIUW and all the other imageIds.
Why wouldn't something ...
0
votes
1answer
26 views
get input file name and file extention using flask
lets say that I have <input name="upload" type="file"> and I am uploading picture.jpg. The question is how can I get the file name+extention? By other words the correct script for ...
-2
votes
1answer
18 views
Indenting db.commit() in sqlalchemy script
I know this should be a elementary question, but for some reason it doesn't make sense to me. I don't understand why the line db.session.commit() isn't indented under the for statement for r in ...
-1
votes
0answers
22 views
KeyError: 'max_size' , error on assigning an attribute of Document type instance
On assigning a datetime object(parser.fidInfo[key].startTime in the model.py file) in python to the DateTimeField/ComplexDateTimeField attribute of document , I get the KeyError: 'max_size' error . I ...
-1
votes
0answers
21 views
Cannot get logging work for Flask with gunicorn daemon mode
I am running a Flask web app using gunicorn+Nginx. I run gunicorn in daemon mode. I configured gunicorn and nginx to log their access and error to files. But I just cannot get Flask logs to a file.
I ...
-1
votes
1answer
25 views
Simple App Routing Flask
Why does going to /uploads/stack1234 give me a 404 error?
filed = "stack1234"
@app.route('/uploads/<filed>')
def stack():
return render_template('filed.html')
0
votes
1answer
13 views
Open Image From Online, Save To Server Flask
I am using Flask to open an image from a URL.
file = cStringIO.StringIO(urllib.urlopen(URL).read())
img = Image.open(file)
I then want to take the image and save it to my site. When I do this, I ...