Questions tagged [flask]
Flask is a micro-framework for Python based on Werkzeug, Jinja 2 and good intentions.
150
questions
1
vote
0
answers
34
views
A server side for a Premier League score guessing app
So I'm writing a Premier League score prediction app with Python, Flask and SQLalchemy and have almost finished the server side of it. I realised that no one has ever looked at my code and there could ...
2
votes
0
answers
79
views
Minimal Chess Web GUI with Flask
Being a big chess fan, I finally started developing my own chess tool, however I'm already quite dissatisfied with where it's going...
folder structure:
...
2
votes
2
answers
73
views
Post Method using Flask
Basically I'm working on an API that receives a POST method and then uses some data to create a json and send it.
There are some constraints, for example the names that I have in my database are ...
0
votes
0
answers
35
views
Flask App - create the admin account (Suggestios or Improvements)
I know this may be a silly question..., but I'm trying to create a function in python that allows me to register an account for the admin user.
If the administrator does not specify any data, be it ...
0
votes
0
answers
78
views
Flask backend for literature database using elasticsearch
The following code is at the core of a larger project (link for context), namely a literature database which mirrors a Zotero library.
The following part of the code takes arguments which are put in ...
2
votes
1
answer
308
views
Simple Secure Python Login Example
I'm trying to determine I missed something here since python isn't my native language.
Python app starts
Python creates a cert.pem and key.pem running this command ...
0
votes
1
answer
32
views
Create-flask-app with a single commend
Lately I was creating a loot of flask apps and I was getting a bit annoyed typing each time all the commands (make venv, flask env, pip installing, gitignore...)
So I decided to make a package that I ...
0
votes
0
answers
140
views
Many to many relationship in Flask with SQLAlchemy
I want to create a family tree where the relationships are only godfather and godson. Is this the right way to declare the personn class ?
...
0
votes
1
answer
149
views
Flask-SQLAlchemy achieve 1 to many relationship that backfills parent when child is updated
Currently I have two tables Plan (plans) and User (users) and there is a foreign key constraint on users which references plans.id
When I create a new user I want to assign a plan to that user via ...
2
votes
0
answers
122
views
Flask API application to serve SPA webapp
I've recently started learning python to gain some fullstack skills and am working on a backend for a webapp as a learning project. Before I get too far down this path I was wondering if someone ...
1
vote
0
answers
93
views
Injecting dependencies in Flask routes without a DI framework
I was wondering what might be the best way to inject Flask routes dependencies without a DI framework.
I came up with something like this (CalculationService being ...
1
vote
0
answers
37
views
bit.ly Clone in Python powered by Flask
Recently, I was studying flask and my friend sent me a bit.ly link. Then the idea of a bit.ly clone struck my mind.
This project uses
Python - 3.10.0
flask - version 2.0.2
Bootstrap CSS. (I am very ...
0
votes
1
answer
989
views
Rendering Radio Buttons Individually in WTForms/Jinja2
I'm building a contact manager with Flask for a community group, and I'm working on the function to export contacts as a spreadsheet. I want to export either all contacts, only those who have been ...
4
votes
2
answers
63
views
Flask static url view
The code runs fine and was manageable without any error handling.
Once I started to handle errors and build out the code the if/elif/else branches quickly became too much. How can I route the view ...
3
votes
2
answers
76
views
Displaying validation messages for an input form
I'm trying to capture all input fields in a form (i.e. sign_up.html) & validating them - if one of them is null or empty then it should show a validation message. I've done it but I'm looking for ...
1
vote
0
answers
82
views
Flask API for converting Contact Form responses to Email notifications (with reCAPTCHAv2)
Introduction
I wrote a proof-of-concept Flask server that accepts responses from a contact form and converts the data submitted to an email. I have added a rudimentary honeypot field that causes the ...
2
votes
0
answers
125
views
Flask Session + Jinja OR Javascript + Flask
I'm a beginner in programming and I'm figuring out what is the best approach for my mini e commerce site project.
My current approach is
...
2
votes
1
answer
96
views
Python app thats simulate simple Stock Exchange
I wrote this simple app for creating a Stock Exchange platform.
It is written with a flask framework.
My main concerns are regarding the user_page route which feels too long and not DRY enough,
But on ...
0
votes
2
answers
816
views
Getting a username from a database and displaying it in HTML
I'm using Flask on Python and I'm displaying the username at the top of the site (and it's working) as follows:
...
1
vote
1
answer
488
views
Read and display JSON results from Google Books API
I’m working with the Google Books API and I’m not so sure about the way I’m going to get the search data and return it to the user. I will describe the path here and I would like to know if you would ...
5
votes
1
answer
176
views
Python Rubiks cube solver - general code comments
I have been learning Python/Flask for the past 5 months outside of full time work and have just finished a first complete version of an app:
Working site: https://rubiks-cube-solver.herokuapp.com/
...
2
votes
1
answer
550
views
Query the github api and filter the last 1000 commits which include and exclude certain words from the top 3 repositories in a given organization
This code should query the github api and filter, out of the last 1000 commits, which ones include and exclude certain words from the top 3 repositories in a given organization.
For example, I could ...
2
votes
1
answer
2k
views
Run python File With get request flask API
Code is Working Review and Recommend What Are Best Practice
What I am trying to achieve.
API with Flask that runs any python file from the current directory.
Run the file and get output in JSON
...
1
vote
1
answer
55
views
text-messaging app using twilio
I build a small web-app using flask for my parents to text their customers about promotions. I am using Twilio API. I just finished the myapp.com/new-campaign page ...
2
votes
1
answer
147
views
Python: separation of concern User Model and User DB
I am working on a small side-project since a couple of weeks, I am using Flask but trying to use as few libraries as possible and no ORMs (for learning purposes.
I am currently working on the User ...
1
vote
0
answers
494
views
Fastapi with Aiohttp not providing expected results
I am new to asynchronous programming in python. Below are two scripts(which perform the same operation) one in Fastapi + aiohttp while other is basic Flask + requests library:
...
1
vote
1
answer
47
views
Populate database of web articles
What I have here is a relatively simple endpoint for a small site I'm making. Idea is to take:
title
content
tags
and create an entry in the database. It works properly.
I threw this together as ...
2
votes
1
answer
351
views
Python (Flask) - User registration system
I am working on a simple CRUD app as a personal project using Flask. I am currently working on the user service and I just finished the registration process. I am also trying to use as less as ...
3
votes
1
answer
1k
views
Python OOP - Web App (Flask) - User registration class?
I am working on a simple CRUD app as a personal project using Flask. I am currently working on the user blueprint and trying to use as less as libraries as I could and no ORM (for learning purposes). ...
0
votes
2
answers
272
views
on using the strategy pattern to switch between database layers
I'd like to build an app in Flask that can switch between talking to a PostGresql and a Mongo DB. As I understand it, the Strategy Pattern is about being able to switch algorithms that are referred ...
3
votes
1
answer
111
views
Flask Database Design with ORM
I am designing a Stock Currency application and for that, I created a database.
I searched for my question here first but the answerer told me to ask the same question here.
...
13
votes
3
answers
368
views
Suggestions on cleaning up Flask app
I've written a little bit of code to pull data out of my FitBit and store it in a GCP database for further analysis. The project is available here, but what I'd like to ask about specifically is the ...
3
votes
1
answer
4k
views
python flask spawn jobs with multiprocessing
I have a python flask app that waits for requests from user app and than spawns a process with job based on the request it receives.
It keeps the status and queue of the jobs in memory.
The requests ...
3
votes
1
answer
82
views
Flask app to return close prices & average
I've been working on a little challenge in order to learn more.. I've written the following code, which works. I'm just concerned that there are several areas where my lack of in depth Python ...
3
votes
1
answer
2k
views
Python Flask, best way for users to update profile details
I have a very standard Flask website being built, more or less straight out of the documentation though am now at a point where I'm going a bit off the book and am probably being highly inefficient ...
6
votes
1
answer
764
views
Air Quality/Environment Monitoring Web App using Plotly Dash
Overview & Motivation
This project manages and displays sensor data (temperature, humidity, Air Quality Index). The sensor data is displayed by the sensor manufacturer, PurpleAir, but their tool ...
1
vote
0
answers
148
views
Improving response time of flask endpoint
The flask endpoint is supposed to take a table name as a parameter, and then return the entire contents of the table as JSON. The table has 200,000 rows and I was wondering if there is any way to ...
2
votes
0
answers
232
views
Simple Flask REST API to a MongoDB
I'm writing a simple REST API to my MongoDB using PyMongo (Python 3.7).
Each collection I have in the DB has a route (e.g http://the.api.url/collection_name ),
and every document under that collection ...
2
votes
3
answers
61
views
Track the existence of process
I have an api endpoint that, when called, initiates the generation of a report. This is time consuming process and response could come pretty late. So, we came up with caching architecture and once ...
4
votes
1
answer
109
views
Weather Forecast Web Application
I've made a Python Flask app and I have some questions about the structure of the main module (equivalent of index.py).
Here is what it looks like:
...
2
votes
0
answers
76
views
Return aggregated values
It's the first time a write a non-trivial mongodb query, and I came up with one that does work, but is 123 lines long! Surely there must be a way to write it in a more concise way.
The purpose of the ...
1
vote
1
answer
454
views
How to make the filtering queries more efficient using flask sqlalchemy?
I have a following table in a flask app
...
2
votes
0
answers
69
views
Basic flask template with sessions
This Flask app, which makes use of SQLAlchemy, a MySQL server which is only reachable via SSH and Flask-Login, is the base on which I want to write an application which has login protected pages.
...
1
vote
0
answers
585
views
Celery tasks and Flask application factory
I am implementing a few Celery background tasks (e.g sending an email, subscribing someone to an Audience via Mailchimp API, etc.) and my project relies on a Flask application factory.
Now, I am ...
1
vote
0
answers
203
views
querying users from table if user.id is found in another table
I am using flask with sqlAlchemy to connect with a postgresql database with two tables
Users table (id, name)
...
4
votes
1
answer
819
views
9X9 Tic Tac Toe variant with frontend in react and backend in python flask_socketio
I (a junior back-end Java dev) decided I wanted to learn some front-end development skills; in particular, I wanted experience with React and websockets. I decided to write an app that would allow for ...
4
votes
0
answers
83
views
Potential Security Threats With Custom Login
I'm looking to find what security flaws this code might have. I believe it's immune to time attacks, passwords are stored encrypted, and I'm using sessions to store local data.
Let's assume the ...
2
votes
0
answers
48
views
Six Nations Prediction league Web App
I built a simple web app to manage my friends and I's six nation prediction league. This is my first go at web development so although it works I am guessing that I am not following all best practices ...
3
votes
1
answer
41
views
A storage bin thingy for Repl.it projects
I have a Repl.it account that I use for my projects, and I don't really want to make a new api for storage every time, I've seen some like EasyDB and Jsonstore (I use Jsonstore in the background as ...
3
votes
0
answers
247
views
Is this a good way to process SQLAlchemy's uniqueness constraint violation in Flask?
I'm using Flask along with Flask-SQLAlchemy and Flask-WTF.
I have a model:
...