Flask

Flask

Application and Data / Languages & Frameworks / Microframeworks (Backend)
Engineering Manager at Taylor and Francis·

We are in the process of building a modern content platform to deliver our content through various channels. We decided to go with Microservices architecture as we wanted scale. Microservice architecture style is an approach to developing an application as a suite of small independently deployable services built around specific business capabilities. You can gain modularity, extensive parallelism and cost-effective scaling by deploying services across many distributed servers. Microservices modularity facilitates independent updates/deployments, and helps to avoid single point of failure, which can help prevent large-scale outages. We also decided to use Event Driven Architecture pattern which is a popular distributed asynchronous architecture pattern used to produce highly scalable applications. The event-driven architecture is made up of highly decoupled, single-purpose event processing components that asynchronously receive and process events.

To build our #Backend capabilities we decided to use the following: 1. #Microservices - Java with Spring Boot , Node.js with ExpressJS and Python with Flask 2. #Eventsourcingframework - Amazon Kinesis , Amazon Kinesis Firehose , Amazon SNS , Amazon SQS, AWS Lambda 3. #Data - Amazon RDS , Amazon DynamoDB , Amazon S3 , MongoDB Atlas

To build #Webapps we decided to use Angular 2 with RxJS

#Devops - GitHub , Travis CI , Terraform , Docker , Serverless

READ MORE
17 upvotes·1 comment·2.4M views
Jon Senterfitt
Jon Senterfitt
·
January 29th 2021 at 7:07AM

But why not just use Contentful?

·
Reply
Software Engineer at Pinterest·
Shared insights
on
FlaskFlaskPythonPythonReactReact
at

One of our top priorities at Pinterest is fostering a safe and trustworthy experience for all Pinners. As Pinterest’s user base and ads business grow, the review volume has been increasing exponentially, and more content types require moderation support. To solve greater engineering and operational challenges at scale, we needed a highly-reliable and performant system to detect, report, evaluate, and act on abusive content and users and so we created Pinqueue.

Pinqueue-3.0 serves as a generic platform for content moderation and human labeling. Under the hood, Pinqueue3.0 is a Flask + React app powered by Pinterest’s very own Gestalt UI framework. On the backend, Pinqueue3.0 heavily relies on PinLater, a Pinterest-built reliable asynchronous job execution system, to handle the requests for enqueueing and action-taking. Using PinLater has significantly strengthened Pinqueue3.0’s overall infra with its capability of processing a massive load of events with configurable retry policies.

Hundreds of millions of people around the world use Pinterest to discover and do what they love, and our job is to protect them from abusive and harmful content. We’re committed to providing an inspirational yet safe experience to all Pinners. Solving trust & safety problems is a joint effort requiring expertise across multiple domains. Pinqueue3.0 not only plays a critical role in responsively taking down unsafe content, it also has become an enabler for future ML/automation initiatives by providing high-quality human labels. Going forward, we will continue to improve the review experience, measure review quality and collaborate with our machine learning teams to solve content moderation beyond manual reviews at an even larger scale.

READ MORE
Introducing Pinqueue3.0, Pinterest’s next-gen content moderation platform (medium.com)
44 upvotes·1M views
Needs advice
on
DartDartDjangoDjango
and
JavaScriptJavaScript

I am currently learning web development with Python and JavaScript course by CS50 Harvard university. It covers python, Flask, Django, SQL, Travis CI, javascript,HTML ,CSS and more. I am very interested in Flutter app development. Can I know what is the difference between learning these above-mentioned frameworks vs learning flutter directly? I am planning to learn flutter so that I can do both web development and app development. Are there any perks of learning these frameworks before flutter?

READ MORE
7 upvotes·495.9K views
Replies (5)
Recommends
Node.js

Hey Muhamed, For web development, you'll have to learn how to write backend APIs and how to build UI for browsers, apps, etc. If you're just starting off with programming, I'd suggest you stick to one language and trying developing everything using it to cut the unnecessary learning overhead. Although Python and JavaScript are very similar for beginners, JavaScript is the only available option for both frontend and backend development for a web application. You can start working with Node.js for your API development and Vanilla JS along with HTML/CSS for UI. You'll only need to learn one language to do all of this. Hope this helps.

READ MORE
11 upvotes·1 comment·160.3K views
Muhamed Suhail
Muhamed Suhail
·
May 2nd 2020 at 4:58PM

Thank You!

·
Reply
Flutter Developer ·
Recommends
Dart

Flutter is good for everything and it is getting better as I am speaking. Flutter Web is almost ready for production and I have made 2 complex working websites already.

READ MORE
6 upvotes·1 comment·160.3K views
Muhamed Suhail
Muhamed Suhail
·
May 4th 2020 at 4:55AM

Thanks Dennis!

·
Reply
View all (5)

We initially though we would use Django because it seemed to have a lot of the things we needed out of the box. After a bit of research we realized that using Flask would be a better option since it is more flexible and would be lighter for our purposes. Having set up our REST api using Flask we believe that we did make the right decision. We found that the flexibility of Flask along with the many extensions available for it to be very appealing. We were able to add the functionality we needed without much difficulty thanks to the quality of the extensions and their documentation.

READ MORE
14 upvotes·2 comments·464.6K views
Saurav Pandit
Saurav Pandit
·
March 29th 2020 at 8:17AM

Dane, if flask use extension, that means developer has to structure their own project. Do you know any good example or article in how to structure flask REST project

·
Reply
Dane Thomas
Dane Thomas
·
March 29th 2020 at 5:07PM

Hi Saurav,

That's a good point. There is more you have to do but it also gives you more flexibility!

The Flask documentation is actually quite good and has some useful examples. Take a look at https://flask-restful.readthedocs.io/en/latest/ for the documention about Flask-RESTful

·
Reply
Associate Software Engineer at Intech Process Automation·
Needs advice
on
ASP.NET CoreASP.NET Core
and
Spring BootSpring Boot

For context, I currently use JavaScript (React) and Python (Flask) in my daily routine.

I need your help in choosing either Spring Boot or ASP.NET Core. Both frameworks seem to have mature ecosystems. I would like to hear your thoughts on the following points:

  • Difficulty level of both frameworks
  • Level of community support
  • Career prospects i.e do Spring based jobs pay more or vice versa
  • which one will be helpful if I decide to transition towards a more specialized field like data engineering.

I am asking this because it is something that I am also exploring in parallel. I know that Python and #SQL play a huge role in big data.

READ MORE
5 upvotes·488.3K views
Replies (4)
Software Engineer ·
Recommends
Spring Boot

I'll preface this by saying I haven't ever done work on the Microsoft stack, so take this with a grain of salt.

Community support: Java tends to have a more active community (and much more diverse universe of new open source projects) than .Net (related to below).

Difficulty level: I'd say the Java/Spring stack is more difficult because Java developers tend to use more community projects and have to know which ones to choose in which circumstances (e.g. what logging framework to use? What database connection pooling library to use? What testing framework to use). That being said, most decisions you have to make have choices that are vastly more popular than others. My impression is that .NET guys use stuff from the standard library almost exclusively. If it's not provided there, it's a problem they never thought to solve or maybe write their own (usually the former).

Career prospects: I'll get hate for this probably, but Java/Spring has more jobs than .Net. .NET Core even more so because it's new. Most .NET jobs out there are going to be not Core, and not on anything other than Windows. LinkedIn search for jobs in United States shows 97,103 for Java and 36,448 for C#. That's not to say some individual city might not have more .NET than Java, but by and large Java is bigger. Also, .NET is not dying at the same pace as say Ruby on Rails (sorry Rails fans). I'd say it's ticking very slowly lower, maybe even holding steady. I wouldn't say you're screwed career-wise if you choose .NET. C# is also pretty similar to Java from what I've seen, and I know professionals that have transitioned to Java (though interestingly, I don't know any that did the reverse). Several companies have basically no .NET footprint, for example, Amazon, Google, Facebook, LinkedIn, Twitter all have Java, but basically no C#.

Specialized fields: Neither Spring or .Net are going to be a thing in a field like data science. That's exclusively Python (some R) for the most part. The only exception being that there is some Java in Hadoop, and Scala in Spark (which runs on the JVM). But I think those are generally more for data products being created, and not data science work. I'm also under the impression this is increasingly less the case than historically. Some other specialties might make Java useful, for example Android development.

In short, Java is the COBOL of the modern enterprise (which is both a good and bad thing). I recommend it to anyone over .NET, but not for technical reasons. It's for reasons related to the questions you asked. There are actually reasons I think CLR and C# are actually better from a technical perspective than Java (unsurprisingly, since they had the benefit of hindsight). But that's not what you were asking about...

READ MORE
5 upvotes·4 comments·334.6K views
Taimoor Mirza
Taimoor Mirza
·
July 16th 2020 at 3:39AM

Hearing you say " Java is the COBOL of the modern enterprise" sounds kind of depressing....

·
Reply
Keegan Witt
Keegan Witt
·
July 16th 2020 at 3:59AM

What I mean by that is that it's ubiquitous and stable. And that I'm maybe a touch cynical after being a Java guy for over a decade.

Innovation has gotten better under Oracle. Sun kinda let the language languish from a lack of new features (e.g. functional programming). But the last several years have picked up and I think has made companies that were looking at Scala or whatever alternative languages decide that the updated Java was good enough and they no longer needed an alternative.

Let's be honest though, all these languages (Python, C#, Java) aren't exciting. They've been around a really long time and are stable workhorses. But that's not a bad thing. A language that has a lot of exciting new features is just gonna break my shit more likely than not.

I'd also add that Python is chipping away at Java's dominance it seems (although it's not happening in the city I live in). So good on you for having that in your toolbelt.

·
Reply
Taimoor Mirza
Taimoor Mirza
·
July 16th 2020 at 7:30AM

Python for sure has been dominating for the several years. However, I've heard that when it comes to the field of data engineering, Java has more edge. Perhaps a lot of tools like Apache Spark and Kafka are based on it and it also the ability to handle large scale data, but I am not sure about it. Another reason of me asking for Spring/ASP.NET Core is the nature of Java and C#. Knowing a statically typed language (and the relevant frameworks) forces you

to think about your code in more cautious manner. They give a different perspective about writing code. But again, these are just my thoughts.

·
Reply
Keegan Witt
Keegan Witt
·
July 18th 2020 at 10:31PM

That is true. Java/Scala are pretty big in data intensive applications, though this is a fairly highly specialized area. Since most data science is done in Python, I think fairly often folks just run their stuff in Python and even though it's not all that performant, it's often good enough. Though there's definitely overlap in that problem-space.

It is useful to understand how both dynamic and statically typed languages work. But I wouldn't say a statically typed language makes you have to be more cautious, I'd say it eliminates a category of problems (things not being the type you expect at runtime -- you always know exactly what types you're dealing with). Java is rather verbose in its syntax, but that's not strictly related to it's lack of dynamic types. Scala is much less verbose, but also lacks dynamic types (but it does have type inference, which is one of the things that reduces the amount of ceremony). Static typing also have better tooling (it's easier for an IDE to autocomplete stuff, etc), and better performance (in theory, someone probably could create a dynamically typed language that performs as well as statically typed languages, but it has never happened yet).

·
Reply
Recommends
Spring Boot

Spring boot helps you creating microservices in hours, not days and there is a very active community around it with amazing integrations. Check one of the tutorials maybe. At least here in Germany, the job market will be better for Spring Boot as well, there are a lot more companies using Java then C#.

READ MORE
5 upvotes·328.6K views
View all (4)
backend developer ·
Needs advice
on
DjangoDjangoPostgreSQLPostgreSQL
and
PythonPython

I'm planning to build a cloud-based project for satellite image browsing, analysis, and downloading. Satellite image includes Sentinel-2, Landsat 8, MODIS, and other more open-source Earth observation datasets, assuming that time span is limited to the recent few years given a relatively limited storage space (i.e., TB-level). Previously, I chose Python due to its advantage of downloading and preprocessing satellite images, and consequently chose Flask as a microservice for scientific calculation. There was a separate service for tile map service to publish tms with stored satellite images using geotrellis. All I want to accomplish is similar to LandViewer. I want to know if it is applicable and scalable to build a fullstack framework using Django? Plus, is it only necessary to store downloaded original satellite image in advance? Any advice on schema design or tech stacks sharing would be appreciated.

READ MORE
7 upvotes·68.9K views
Replies (2)
Recommends
Django

Django is quite powerful out of the box and will give you the benefit of MVC for speed of development and scalability. Depending on your Flask services, you could migrate them as well, or just migrate them to Django, since you can perform the same calculations in python and do so within a model. I am not sure if you are receiving image files or image data, but either way you can process them to a byte array or blob and store them that way.

READ MORE
5 upvotes·1 comment·6.4K views
Tapan Biswas
Tapan Biswas
·
September 4th 2020 at 6:48AM

This is amazing info, You can build it easily. Check out some new stuff <a href="https://bestbuyflix.com/best-wireless-bluetooth-earphones-under-rs-2000/">Best Wireless Bluetooth earphones</a>

·
Reply

Although I don't know what kind of analytics you will run and if it involves image processing. Generally if you want to show the user an image, you might want to have scaled down versions of the image for preview and divide the images into blocks, like quadtree or something. and then when people zoom in you can load parts of the image in the browser. And pre processing the image could be a different thing which you can run probably on a different server with more ram capacity and better disks.

READ MORE
1 upvote·5.4K views
Needs advice
on
DjangoDjangoFalconFalcon
and
FlaskFlask

I'm planning on building an android app using Flutter (I will be making ios too later) It's a social media type application. I'm confused about what framework to choose from Django, Flask and Falcon.

(please inform if I should provide more detail about something)

READ MORE
1 upvote·7K views
Needs advice
on
FlaskFlaskGolangGolang
and
Node.jsNode.js

Flask vs Go vs Node.js which is better for making SAAS application. Need Help!! please provide roadmap of learning for Developing SAAS Applications.

READ MORE
1 upvote·780 views
backend developer ·
Needs advice
on
FlaskFlask
and
RedisRedis

I'm designing a website using Flask with authentication based on reference token. I only use Redis for storing token (used as access token) with specified expiration (a long lifetime). Plus, to authenticate users heading for a specific web page from the home page. I store some info about user authorization level in value of key-value pair in Redis (ps: key, i.e., a token identifier that will be issued to client as bearer token). I have to verify key-value pair at each request. Is there any advice to help me improve this design? Thanks

READ MORE
8 upvotes·56.7K views
Replies (1)
Sr.SWE at Celare Cyber Systems·

It is a normal design until you'll see that requests to REDIS are a real bottle neck. As an alternative take a look on JWT, it allows to send encrypted payload verified by server's signature and do not check DB, but read carefully it's security limitations.

READ MORE
4 upvotes·2 comments·6.2K views
GS Tao
GS Tao
·
August 11th 2020 at 1:43AM

IMHO, revocation is a limitation of JWT as self-contained token (or I prefer to call it by-value token) that contains its lifetime (or expiration) and, in my scenario, if I put some info about user's authorization level for accessing resources in payload, it would be too sensitive. That's why I previously decided to choose some alternative to JWT, such as by-reference token. Any suggestions about these PROs and CONs ? How to integrate Redis with JWT from your perspective ? Thanks

·
Reply
Andrei Beliak
Andrei Beliak
·
August 11th 2020 at 4:25PM

I'm not sure if REDIS will be involved in JWT based scenario except maybe the initial credentials (before issuing JWT to the client) checking. I do not know your performance goals but I still think that your solution could be very fast because REDIS us really fast.

Also the choice depends on use cases because for the first time you have to hit DB to auth user anyway, JWT just lets you not to hit DB on each request, so it suits better for many requests per user and isn't good for many signs with less requests / shorter sessions. But anyway I would suggest to use REDIS first, the approach is quite straightforward and if you'll meet the real inability to process all the session keys and that will be clear because of the REDIS, then think about alternatives.

·
Reply

Server side

We decided to use Python for our backend because it is one of the industry standard languages for data analysis and machine learning. It also has a lot of support due to its large user base.

  • Web Server: We chose Flask because we want to keep our machine learning / data analysis and the web server in the same language. Flask is easy to use and we all have experience with it. Postman will be used for creating and testing APIs due to its convenience.

  • Machine Learning: We decided to go with PyTorch for machine learning since it is one of the most popular libraries. It is also known to have an easier learning curve than other popular libraries such as Tensorflow. This is important because our team lacks ML experience and learning the tool as fast as possible would increase productivity.

  • Data Analysis: Some common Python libraries will be used to analyze our data. These include NumPy, Pandas , and matplotlib. These tools combined will help us learn the properties and characteristics of our data. Jupyter notebook will be used to help organize the data analysis process, and improve the code readability.

Client side

  • UI: We decided to use React for the UI because it helps organize the data and variables of the application into components, making it very convenient to maintain our dashboard. Since React is one of the most popular front end frameworks right now, there will be a lot of support for it as well as a lot of potential new hires that are familiar with the framework. CSS 3 and HTML5 will be used for the basic styling and structure of the web app, as they are the most widely used front end languages.

  • State Management: We decided to use Redux to manage the state of the application since it works naturally to React. Our team also already has experience working with Redux which gave it a slight edge over the other state management libraries.

  • Data Visualization: We decided to use the React-based library Victory to visualize the data. They have very user friendly documentation on their official website which we find easy to learn from.

Cache

  • Caching: We decided between Redis and memcached because they are two of the most popular open-source cache engines. We ultimately decided to use Redis to improve our web app performance mainly due to the extra functionalities it provides such as fine-tuning cache contents and durability.

Database

  • Database: We decided to use a NoSQL database over a relational database because of its flexibility from not having a predefined schema. The user behavior analytics has to be flexible since the data we plan to store may change frequently. We decided on MongoDB because it is lightweight and we can easily host the database with MongoDB Atlas . Everyone on our team also has experience working with MongoDB.

Infrastructure

  • Deployment: We decided to use Heroku over AWS, Azure, Google Cloud because it is free. Although there are advantages to the other cloud services, Heroku makes the most sense to our team because our primary goal is to build an MVP.

Other Tools

  • Communication Slack will be used as the primary source of communication. It provides all the features needed for basic discussions. In terms of more interactive meetings, Zoom will be used for its video calls and screen sharing capabilities.

  • Source Control The project will be stored on GitHub and all code changes will be done though pull requests. This will help us keep the codebase clean and make it easy to revert changes when we need to.

READ MORE
13 upvotes·354.6K views