Flask is a micro-framework for Python based on Werkzeug, Jinja 2 and good intentions.
4
votes
1answer
33 views
Flask Database Model Design
I am developing my first website in Flask using PostgreSQL and I want my database to have professors from all universities and courses in the USA.
As I am not very familiar with databases I have ...
1
vote
1answer
30 views
How to optimize the Flask RestFul api
The tutorial is here
I want to build a RestFul API with Flask to query User Agent data. Curl script shows below. The api should work with three or two or one or even zero argument.
So how to change ...
0
votes
0answers
14 views
A Base Controller (parent) class based on flask pluggable view
A controller based on flask pluggable view. the base controller is made as parent for the routing controller. the goal of this BaseController is to make my routing controller become OOP.
...
7
votes
1answer
77 views
Simple Flask API backend to maintain a word list
I made a little toy project last semester. I would like to get some insights about my code, particularly the part of handling the database. It is a CRUD kind of traditional API.
...
0
votes
0answers
19 views
A basic flask Backend for a weather monitor using RasPi
This is the main script. The app when done would have a daemon running on a Raspberry Pi which will use the
...
3
votes
0answers
26 views
Flask site that uses x-editable to edit elements and update mysql db
This code is built in flask, it allows a user to edit a title and a description of a div.
I have used the X-editable library which allows a user to edit text and use ajax requests.
I also process ...
4
votes
2answers
169 views
RESTful APIs (Create, Read) with flask-restful
I wrote this simple API to be able to send logs from the client to MongoDB. Even though this works and fits my need, I would like to point out some concerns that I have regarding the following:
Is ...
3
votes
0answers
104 views
Validating HMAC-SHA256 signature in Python
I am trying to implement HMAC-SHA256 authentication into my Python RESTful API project. I am using Python Eve (built on top of Flask), started with an simplified HMAC-SHA1 example.
My application is ...
1
vote
0answers
104 views
Parse query filter expression from request URL
I am building a backend APi for which I need to extract query filters from request URL of following pattern:
...
2
votes
0answers
104 views
Simple Payment System Flask App
Can I please get some reviews and suggestions?
This is what this app does:
It picks user login from Users table and compare it with the post in the login ...
2
votes
0answers
126 views
Improving the flask cache decorator
In my rumblings developing flask applications I found the caching decorator. The decorator is a short and well-written piece of code, but I feel like it misses the few points bellow:
It only caches ...
3
votes
1answer
164 views
Applying dynamic filters to a SQL query using Python conditional expressions
I wrote this piece of code to eliminate the need for multiple if then statements based on the filters from the incoming REST request.
If the request has category ...
0
votes
0answers
76 views
Alternative session token implementation in flask
Here is my implementation of an alternative session token. The idea is to reset session_token every time get_id is called, so (I ...
3
votes
1answer
195 views
3
votes
1answer
192 views
Class of file uploading to S3 using boto with multipart supported
I'm writing an app by Flask with a feature to upload large file to S3 and made a class to handle this.
I have some targets in writing code:
Code must be easy to understand and maintain. (Yes, ...
2
votes
1answer
73 views
SQLite database for a micro/tumble blog application
I'm creating a personal website where, among other things, there is a blog, or a "microblog" (I'm still not sure how to define the two), where I will be writing articles and having users, who will ...
2
votes
0answers
173 views
Online Snake v0.1 with Python-flask and socketio
What I am essentially doing is writing a snake game that everybody could play on the internet, broadcast their game if they like and so on. Now it looks like this, just websocket-based snake, no user ...
8
votes
1answer
59 views
2
votes
0answers
189 views
Using Flask-SocketIO in conjunction with Flask-WTF / WTForms to provide realtime form validation feedback
I am working on a user login using Flask and the following extensions: Flask-Login, Flask-WTF, ...
1
vote
0answers
85 views
Run a potentially long running application from within a Python webserver and return different results depending on whether the application finishes
I want an API on a Flask/Gunicorn webserver to make a call to a separate, potentially long-running java application. If the java application finishes before the Gunicorn timeout, Flask should return ...
2
votes
0answers
65 views
Implementing Flask create_app function with SqlAlchemy
I have a simple Flask app that realises rest-api with SQLAlchemy. I have written this create_app function:
views.py
...
1
vote
0answers
82 views
Flask json rpc2.0 extension
I created a simple extension to handle JSON RPC 2.0 requests on flask
I would like some feedback regarding usage
here is an usage example:
...
2
votes
1answer
328 views
Utility Class for CRUD Operations in a Flask App
I'm new to Flask and Python and am trying to sort out the most pythonic way to modularize my utilities. I have models.py which have my sqlalchemy models and ...
5
votes
1answer
316 views
login_required decorator in Flask
I have 2 Flask apps (different projects) that work together . One implements some API which uses tokens for auth. The second one consumes the API and makes a web interface for it. Now I have a login ...
10
votes
1answer
2k views
Python GUI by QtWebkit and Flask
I'm new to Python. For learning purposes, I want to create desktop application by using QtWebKit and Flask. You can find the source code here
Main idea is:
create a form including a QWebview widget
...
6
votes
1answer
12k views
Simple login system using Python Flask and MySQL
I've made a login page using Python Flask which works with MySQL. I started learning Flask 2 days ago and it was fun, so I came up with this:
...
2
votes
0answers
263 views
Jinja template with Flask
I have this code querying for some objects from my database with Flask-SQLAlchemy:
areas = Area.query.all()
subareas = Subarea.query.all()
And then I use it on ...
2
votes
1answer
42 views
Extension pattern in a flask controller using importlib 2.0
The first edition of the code can be found in this 1.0 version.
To summarize the problem :
I have an endpoint in flask where the work logic change according to the query
I am trying to implement an ...
8
votes
1answer
132 views
Extension pattern in a flask controller using importlib
I am trying to load a module according to some settings. I have found a working solution but I need a confirmation from an advanced python developer that this solution is the best performance wise as ...
1
vote
1answer
59 views
Add user to a database and perform relevant checks
Below is a function that adds a new user to the database using their email and password. I am using Flask and SQLAlchemy.
...
2
votes
1answer
56 views
Fetching and displaying the provisioning status of a phone number
I have the following function:
...
3
votes
1answer
695 views
Flask form validation technique
This is currently the code that I'm using to validate and check for errors in a flask app, where the form fields are coming from a /registration html page:
...
3
votes
3answers
330 views
Flask route to pull data from database for getJSON to process
I am developing a reporting application in Flask where I pull data in a route function from a postgresql database and jsonify the data. On the client side I have ...
4
votes
0answers
1k views
Is this implementation for token based authentication in flask-peewee secure and efficient?
I'm making an app with a Flask API backend using a Flask-Peewee ORM and an AngularJS frontend.
The Flask-Peewee ORM doesn't support token based authentication, so I decided to try to implement this ...
1
vote
2answers
1k views
Utilization of Steam APIs and web-scraping
Some background info here:
This is a small fun project I made utilizing Steam APIs and web-scraping
This is the first time I've ever used Python, so I'm not very familiar with the language
I used ...
2
votes
0answers
230 views
Structure of database model for a Flask project
I'm working on a project with Flask and I'm trying to follow Miguel Grinberg's Flask tutorial as closely as possible while creating what I need for my own project.
Overall, how does it look? Miguel's ...
2
votes
1answer
146 views
Simple web application for benchmark
There is an article where the author tries to compare performance of different web stacks. The result looks pretty controversial.
I try to prove that in real use case the difference between scores of ...
3
votes
1answer
1k views
How to better indent multiline strings with many string formatting args?
I have a function, that is used in flask, for logging application errors:
...
8
votes
1answer
1k views
Multi-dictionary API using Python Flask-RESTful
I'm working on a simple online dictionary tool, using Python Flask-RESTful as the RESTful API backend. The dictionary tool is modular, it can handle multiple dictionaries, implemented as independent ...
3
votes
1answer
89 views
Catching API changes for a service that doesn't version its API
I'm using the old Google Data API to access several spreadsheets and put their contents in a database using Flask and SQLAlchemy. Each run deletes the contents of the database tables and repopulates ...
7
votes
1answer
410 views
Subclassing Flask for Permissions with Google App Engine
I'm trying to set up a very lightweight permission system using Google App Engine and Flask.
The end result I am hoping for is that each individual view is its own permission, and in an admin panel ...
4
votes
1answer
334 views
Caching a function view for a day
I am writing a flask app that I will deploy it on Heroku to test it. There is a page that will generate daily photos and information based on a JSON file. The view is valid for 24 hours beginning from ...
2
votes
0answers
335 views
Providing a daily feed of current segmented customer data for targeted email campaigns
I just started with Python a month ago, and with Flask this week. This is my first project.
I am curious about general style, proper use of Python idioms, and Flask best-practices.
run.py:
...
1
vote
1answer
317 views
Python flask web app, simplification
I am writing web application using flask framework + mongodb. I have an issue, should I use classes for my mongo entities or just use dictionaries for them.
...
1
vote
2answers
203 views
Simple Python Flash app using Wikidot API to transfer pages between two wikis
Here's a simple Python Flask app. It uses the Wikidot API to transfer pages between two wikis. I'd like to hear your input on the best way to refactor this code. Here are a couple of questions I ...
2
votes
2answers
993 views
Database calls with Python Flask and SQLAlchemy
I am creating a Python Flask webservice and this is basically how I am doing all of my database calls if a webservice needs to interact with the database:
...
12
votes
1answer
5k views
Flask-SQLAlchemy models and unit-testing
This is my first time building anything remotely like a robust database. I'm midway through designing it and I would be grateful if you have suggestions or have found any logical errors.
Goal: allow ...
4
votes
2answers
884 views
Authentication for a Flask API
I've written a couple of functions to check if a consumer of the API should be authenticated to use it or not.
Have I done anything blatantly wrong here?
Config
...
4
votes
1answer
1k views
5
votes
1answer
307 views
Contest assist web app
This is a small web application that I have created using the Flask framework.
I am looking for best practices feedback, as well as design pointers. I am not confident that my design choices have ...