Category "flask"

Flask cannot import from website create_app

ImportError: cannot import name 'create_app' from 'website' from website import create_app app = create_app() if __name__ == '__main__': app.run(debug=Tr

502 Bad Gateway upstream prematurely closed connection while reading response header from upstream with flask, uWSGI, nginx

how are you? I have a server on DigitalOcean with Ubuntu 16.04 I am making a Flask Application with uWSGI and Nginx. My files look like: wsgi.py: from flaskap

secret key not set in flask session, using the Flask-Session extension

Right now I am using a flask 3rd party library Flask-Session and I am having no luck getting a session working. When I connect to my site, I get the following e

How to change downloading name in Flask?

I'm using Flask's send_file to serve a file at a specific URL. However, the name of the saved file is always the last part of the URL, like download, instead of

Why is the database of the webapp in the book "Head First Python 2nd Edition" not working as it should?

I'm currently studying Python by reading the book "Head First Python 2nd Edition" and it is really helpful and well-written, but I think it is a little anachron

Implementing OpenID with Apache Superset. AttributeError: 'bool' object has no attribute 'is_active'

I am trying to implement OpenID in Apache Superset. I am using Broadcom CA-SSO as my provider. I found a similar post in Stack Overflow where someone implemente

How do I setup files to run multiple flask (nginx, gunicorn) applications on one server? (specify separate ports)

After getting each application to run on their own you need to specify the port in the application, nginx and gunicorn/service files. I am using AWS with Centos

how to view WTForms validation errors?

I am writing some basic tests and have a test failing. def test_new_user_registration(self): self.client.get('/user/register') form = RegistrationForm(

Connecting Heroku Database to SQLAlchemy

so as part of a Web Programming MOOC, I have to connect to a PostgreSQL Database hosted on Heroku using Python and SQLalchemy. I have spent a lot of hours tryin

Logout if session expires from no activity and redirect to login page

I'm trying to update a website with flask where users have accounts and are able to login. I want to make user session expire and logout if there is no activity

How to display validation errors when WTForms is coupled with Jquery Form Plugin?

I am trying to combine WTForms with jQuery Form Plugin. With the latter, I bind a form and provide a callback function. On the other hand, WTForms has to do th

Flask blueprint static directory does not work?

According to the Flask readme, blueprint static files are accessible at blueprintname/static. But for some reason, it doesn't work. My blueprint is like this:

Python Vlookup to return one value only - similar to excel

I'm trying to replicate an Excel Vlookup in Python, using Flask. I've an excel sheet, set out like this: (Item is column A, Price is column B). Item:

Return Excel file in Flask app

I am creating a Flask application that prompts the user for an Excel file, does some work with it, then returns the file back to the user so that they can downl

Simple Flask app runs but page will not load

So last night I closed terminal without closing my flask app or deactivating my venv. I think maybe this is the cause of the issue but none of my googling has y

Nested print statements in Jinja template

I am creating a link in a Jinja2 template using Flask and I am running into a problem. I want to access a variable passed to the template within a code block, b

Flask CORS work only for first request, what's the bug in my code?

background There is a JS app serving at 127.0.0.1:8080, which refers some API serving at 127.0.0.1:5000 by a Flask app. [See FlaskCode] When I open this js app

Flask: The browser (or proxy) sent a request that this server could not understand

I created a small Flask service. However each time I tried to use the say-hi endpoint, I get the following message: { "message": "The browser (or proxy) sen

Get query string as function parameters on flask

Is there a way to get query string as function parameters on flask? For example, the request will be like this. http://localhost:5000/user?age=15&gender=Ma

Jquery button click to send AJAX request with Flask and Python

I am trying to make a web application that accepts button clicks. The button clicked then sends a specific device, and operation code to the python application