Three Python libraries used by startups

Source: Internet
Author: User
Startups have published a blog post on Instavest, the three Python libraries that are favored by startups, this article has aroused heated discussion by developers on Hacker News. if you are also interested in this article, you may wish to take a look at it later. I will briefly translate this article to share it with more developers and friends. The translation is as follows:

 1. Whitenoise

By simply modifying the Config file, you can deploy Web applications in a static file as intended without relying on external services such as Nginx and Amazon S3. Whitenoise can compress the packaged content and set a high-capacity cache.

Applications that comply with the WSGI specifications need to adjust the Whitenoise configuration during deployment:

from whitenoise import WhiteNoisefrom my_project import MyWSGIAppapplication = MyWSGIApp()application = WhiteNoise(application, root='/path/to/static/files')application.add_files('/path/to/more/static/files', prefix='more-files/')

What is the importance of doing so? Gzip can effectively reduce the volume of static files and load pages. However, the search engine detects Gzip compression, which causes the website to not execute Gzip. Therefore, we need to avoid this situation through the above modifications.

 2. Phonenumbers (Lite version)

Identifying a phone number is not easy, and regular expressions may not be able to handle a wide variety of valid phone formats.

For example:

  • Invalid: 222-222-2222 (this will pass the regular expression test)

  • Valid: 313-442-1231 external line. 901

It can be seen that relying on a single regular expression detection may not be able to get the desired answer, so use the tool-Phonenumbers as appropriate. It is recommended because it is small and practical, and does not have metadata data such as geographic code, operators, and time zones. It can recognize multiple formats and then use different formats/styles for effective matching.

3. Development Kit

With the help of development kit, HTML can be easily converted into PDF files. How can this be used? For example, if your application has a page containing invoice information, you can use the development kit to generate a PDF file for users to download. its usage is as follows:

import pdfkitpdfkit.from_file('test.html', 'out.pdf')# Generating PDFs from strings and web-pages is equally easy:pdfkit.from_string('Hello!', 'out.pdf')pdfkit.from_url('http://google.com', 'out.pdf')

If you have your favorite Python library, leave a message to share with you.

The above is the details of the three Python libraries used by startups. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.