3 python libraries used by start-up companies

Source: Internet
Author: User
Tags time zones
Instavest published a blog post that shares the 3 Python libraries that are loved by startups, and this article has sparked a heated discussion among developers on hacker News, so if you're interested in it, you might want to take a look. The author will translate this text to share to more developer friends. The translation is as follows:

 1. Whitenoise

Simply modifying the config file allows the user to deploy the Web application in a static file as he or she wants, without having to rely on external services such as Nginx, Amazon S3, and so on. Whitenoise can compress packaged content and set high-capacity caches.

Applications that follow the WSGI specification require adjustments to the whitenoise configuration at deployment time:

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 this? Use gzip to effectively reduce static file volume and page loading. However, the search engine detects gzip compression, which causes the site to not perform gzip. Therefore, we need to avoid this situation through the above modification.

 2. Phonenumbers (Lite version)

Identifying a phone number is not an easy task, and regular expressions do not necessarily handle a variety of valid phone formats.

For example:

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

    • Valid: 313-442-1231 outside the line. 901

It can be seen that relying on a single regular detection does not necessarily get the answer you want, so use the tool-phonenumbers appropriately. Recommended reason is that it is small, practical and simple, no geographical generation code, operators, time zones and other metadata data. It can recognize multiple formats and then use different formats/styles for effective matching.

3. Pdfkit

With Pdfkit, you can easily convert HTML into PDF files. What is the use of this? For example, if your app has a page with invoice information, you can use Pdfkit to help generate a PDF file for users to download, using the following:

Import pdfkitpdfkit.from_file (' test.html ', ' out.pdf ') # Generating PDFs from strings and web-pages are equally easy:pdfkit. From_string (' hello! ', ' out.pdf ') pdfkit.from_url (' http://google.com ', ' out.pdf ')

If you have your favorite Python library, you may wish to share your message with us.

Related Article

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.