We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [flask]

Flask is a lightweight framework for developing web applications using Python.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Is there any trade-off between using parameter in the flask factory method vs no parameter (instead use env variable)?

In flask (example - https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/#basic-factories), following is the code provided: def create_app(config_filename): app = Flask(__name__) ...
0
votes
0answers
6 views

How to deploy python script in python http.server

My actual requirement is to expose a python script as a web-service. Using flask I did that. As Flask I snot a production-grade server. I used uWSGI to deploy that. Most of the sites suggesting to ...
0
votes
0answers
21 views

What is the correct way to handle users in a Python website? [on hold]

I am new in Python and web development. I am building a beginner website using flask and a user system is necessary. I have been handling users using session variables which is, I guess, not a good ...
0
votes
0answers
14 views

HTTP Status code 404 vs 204 in flask rest api [duplicate]

Basically i have a post filter api , which is going to filter based on some filed . It will take two parameter to filter against db. example username and city.If i will hit the api with username='Jack'...
0
votes
1answer
24 views

Proper way of using passlib with Flask

Using Python and Flask I've created register page with name, email, password and confirm password fields. In order to store passwords in the DB in encrypted format I went for passlib. I've reached a ...
-2
votes
0answers
32 views

How can I make a private messaging system in flask? [on hold]

I have been looking into the topic of private messaging using Python's Flask web framework. I haven't found much that shows how to enable user to user private messaging. I was wondering if anyone ...
0
votes
0answers
8 views

Is it possible to use google openid in flask as IOS app login?

I try to write a flask server as my IOS app backend. And I want my IOS app user only input the google account and password and the flask server will deal with the login detail. I read some flask ...
0
votes
0answers
11 views

Unable to Deploy Flask App on Gcloud: ModuleNotFoundError: No module named 'flask_bcrypt'

I am getting the following error when deploying my gcloud app with: gcloud app deploy app.yaml and I would get a "Error: Server Error" at the site even it is built successfully. The logs read the ...
-2
votes
1answer
25 views

JavaScript and Python Communication via POST [duplicate]

So I'm creating a basic data science calculator using Python. I'm trying to send form data from the website to a python function based on Flask but alas its not working. I created a basic post ...
0
votes
0answers
17 views

Gunicorn flask error ImportError: attempted relative import with no known parent package

First off this is not like the typical relative importation error in python so that should be noted. Basically I have deployed my flask app to heroku using gunicorn and the app shows the Application ...
-1
votes
0answers
10 views

Uploading Photo Path and Saving localy Using Flask-Admin, Flask-wtf and mongoDB

I am using the flask-admin extension, flask-wtf and pymongo. I am trying to upload a photo using the flask-admin view with the wtforms. I want to save the form content localy on server and push the ...
1
vote
1answer
37 views

Flask API run on Docker but can't access

I'm trying to run my API with Docker. I've managed to build and run it but, when I test it in Postman, it doesn't work. I have a folder that contains uhopper.py(which is the API), requirements.txt and ...
-1
votes
0answers
15 views

Best stack for uploading and processing several pdf files on a website?

I'm making a website where users can upload several pdf files (normally 10 MB in total, but can it can go up to 80-100 MB) and extract certain parts of those files in an Excel sheet. It involves heavy ...
0
votes
1answer
20 views

How to request for select tag name choice, not a value choice in flask?

Let's say you have the following form in HTML: <form method="POST"> <select class="form-control" id="startyear" name="startyear"> <option value="2005">first</...
0
votes
0answers
24 views

Using flask-sqlalchemy and sqlalchemy together, why and is it safe

I have been working on a flask app that is database intensive for about 4 months. I am pretty new to python, flask and sqlalchemy but very familiar with web and database programming. I mainly use ...
-1
votes
1answer
43 views

Should API fetching be frontend or backend? [on hold]

My website application is using React for the frontend, and I'm deciding between ExpressJS or Flask.py for the backend. Either way, I know React has API fetching functions but also the other backend-...
-1
votes
1answer
12 views

How to reference a variable in Flask for other app.routes [duplicate]

Im a student learning how to use flask and planning to integrate it with Matplotlib ( The graph maker library). I have got inputs from the user and stored them as variables. However, the variables are ...
0
votes
0answers
11 views

Python Flask - ajax jquery is not working when extending layout.html

I am new to python & flask in general but I have been trying to get a button click to perform a function, which I have managed to do. But when I try to extend the layout.html to get my desired ...
-1
votes
0answers
31 views

How do I access individual nested values in a json / jsonify response? Python & Flask

I made a script to do calculations I do daily in my job, thou when trying to flask-ify it I stumbled on a issue making use of the jsonified-response. The result-variables sent thru will always be the ...
0
votes
0answers
27 views

Python flask error code 400, message Bad request version

The code of the website from flask import * app = Flask(__name__) @app.route("/<name>") def user(name): return f"Hello {name}!" @app.route("/") def home(): return render_template("index....
1
vote
1answer
20 views

Flask returning 404 on static files regardless of pathing to the static folder

I am attempting to use flask to access a csv file and two json files which are being held in a folder named static. Even though i have mentioned the static folder in my code i am still having the ...
-4
votes
0answers
58 views

When using factory pattern, and if I have only a few (say 4) routes, then why should I use blueprints when there are other alternatives?

I am following this link: http://flask.palletsprojects.com/en/1.1.x/tutorial/factory/ Foll. is code that creates the flask app factory. At the bottom it is registering the @app.routes. Assuming I ...
0
votes
0answers
7 views

Nexmo call status tracking when hanged-up

I am making a voice IVR for my project using nexmo API powered by Flask using ngrok. The code works quite well in all cases but fails when the caller hangs-up/cuts/puts down/cancelled the call in ...
0
votes
0answers
20 views

How to add HTML Tags in the Middle of the Article / Post

I have an article obtained from the database. The following example mystring = "<p>Lorem ipsum</p><p>Dolor sit Amet</p><p>Lorem ipsum</p><p>Dolor sit Amet<...
0
votes
0answers
19 views

Python Flask pass strings from backend to JavaScript

I use this template to pass values from Flask to the frontend (chart) @app.route("/allusers", methods=["POST", "GET"]) def allusers(): if request.method == "GET": user_collection = mongo....
-1
votes
0answers
19 views

How to avoid attacks and/or switch to production mode in Flask?

I have created a dynamic web server using Flask. I am running it with a command sudo python www.py However, my server crashed twice in two days because somebody posted dozens of request of type "...
0
votes
1answer
43 views

How do I solve 404 Flask error in python?

I'm dealing with text files and new in learning API building with Flask, I wanted to have data extraction from text files, and would like to generate the JSON output, but unfortunately, i keep getting ...
-1
votes
1answer
6 views

heroku error Process exited with status 3

I was trying to create an app with the learned model with flask through Heroku env 2019-11-17T01:24:29.506868+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter....
-3
votes
1answer
30 views

is there a Python program using flask to use post method from a json [duplicate]

I have a json declared in my code. I want my json to be printed in postman once I hit that parameters. EX: Json = { "array": [ { "ques": "1", "resp": { ...
0
votes
1answer
26 views

Cannot connect to SocketIO using Flask

I'm trying to create an app that uses SocketIO, I'm using Flask-socketio and using Socket.io Client Tool to test the connection of the socket. I've done it as shown in the flask-socketio's ...
-1
votes
3answers
37 views

How to calculate how many minutes ago a post was created?

Question is asked in title. The problem is that i want my website to be used globally and because there are different timezones i would like to say how many minutes/hours/days/years ago something was ...
0
votes
0answers
10 views

Cannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists

I'm trying to spawn a few background, celery beat processes using docker-compose, but they are not working anymore. My configuration: docker-compose-dev.yml worker-periodic: image: dev3_web ...
0
votes
0answers
19 views

Nexmo: How to transfer call route to the same function again and again to form a loop

I am trying to make a simple voice IVR for my project using nexmo API. Please refer to the image for exact clearance. basic idea by flow diagram of what I am trying to do as ivr. Now the problem ...
0
votes
1answer
17 views

flask returning json of arrar of array

My flask api returns data that is hard to work with in JS on the front end. Here is endpoint: class BilagList(Resource): def get(self): connection = sqlite3.connect('data.db') ...
0
votes
1answer
23 views

how to retrieve Python array in javascript (Flask to React communication)

I dumped Python array to a response with json.dumps and now I'm trying to retrieve the data as Javascript list. @app.route('/get_scales') @cross_origin() def get_scales(): classes = inspect....
1
vote
0answers
18 views

Concurent (multi-user) processes for flask background tasks?

I have a simple python tool hosted on an ubuntu Linux server (HTML Form + Flask + Python code); Phases: Data taken from HTML Form into the backend and processed by a python code and then return a ...
0
votes
0answers
14 views

HTML live video feed hosted through flask is not visible on other devices

My friend and I are working on building a small rover to drive around for fun. We are going about it by creating a website that would be hosted on a Raspberry Pi so that only people connected to the ...
0
votes
0answers
9 views

How to test failed PayPal Checkout sandbox transactions

So I'm using the Paypal Checkout Basic Integration found here in a Flask app but can't tell how to test failed sandbox transactions. The closest I've come in the paypal documentation is this link but ...
0
votes
0answers
14 views

get id not value from SqlAlchemy_wtforms QuerySelectField

I have been trying to make a relationship between two table and have a QuerySelectFiled to select a field from the other table, I have managed to do so, but the problem came when I wanted to submit ...
0
votes
2answers
45 views

pass a parameter to a view function (form) in a for loop to populate form flask wtforms sqlalchemy

I want to be able to display the rows of a database model on my web page as an updatable prepopulated form! I can display the rows on the page easily and I can add a link to each to open a seperate ...
-1
votes
0answers
8 views

Flask Validators İssues [on hold]

I tried making a register form with flask and wtforms but wtforms validators don't work. from flask import Flask, render_template, flash, redirect, url_for, session, logging,request from ...
-1
votes
0answers
14 views

Create a JSON Response from 2 Arrays with Python [duplicate]

I want to create a python JSON response, served by flask. I have 2 Arrays of values: Files and Filesizes. How can I join them to one JSON Object? sizes = [10, 120, 3214] files = ["file1", "file2", "...
-1
votes
0answers
20 views

How to show user input on website with Flask

I'm trying to make a page on by website with 2 forms that, once submitted, appear in a text section below. Is their any way to do this easily with Flask? Thanks in advance.
0
votes
0answers
20 views

Debugging flask with Docker compose interpreter force debug mode off

I followed this tutorial and after a long time I was able to debug the application. The problem is when I want the application to restart when I make changes locally. The problem is when I want the ...
-1
votes
0answers
16 views

How do I mock yaml file dependency in Python for testing purpose

So I have written rest end-points in python for performing CRUD operations with data stored in a YAML file. How do I mock the YAML file dependency for writing unit tests
0
votes
0answers
29 views

How do I change my inputs (that is connected to a function) from one html file to another?

I can't figure out how to change my inputs that is connected to a function to a another html file. This is my html file: function onDrawClick() { var x = document.getElementById("xFieldId")....
0
votes
0answers
18 views

Python Flask celery with rabbitmq unacked messages

I have a Flask app (application factory pattern) and want to implement celery. I choose the guide from miguel (https://blog.miguelgrinberg.com/post/celery-and-the-flask-application-factory-pattern) to ...
0
votes
1answer
16 views

Stripe Error: Cannot create the usage record with this timestamp because timestamps must be before the subscription's current period end time

I am creating a flask app that integrates with Stripe for subscriptions. I'm trying to create a stripe usage record for a customer on a metered plan. datetime = str(int(dt.now().replace(tzinfo=tz....
-4
votes
0answers
28 views

How can i display a website opened in server browser and not directly opened in user browser using flask [on hold]

i have a website opened on my server for example i opened abc.com on my server. then a web page is displayed on my browser now i have a web server installed on the same computer using flask. the ...
-4
votes
0answers
19 views

Flask cannt find module “ModuleNotFoundError: No module named”

enter image description here enter image description here I tried all methods. Even if rewrite "from final_task.rss_reader import logg". python 3.8. Start server with "flask run". Without flask it ...