简体   繁体   English

WSGI和API有什么区别?

[英]What is the difference between WSGI and API?

I hail from non programming, non computer science background and am learning software engineering for data science.我来自非编程、非计算机科学背景,正在学习数据科学软件工程。 As a part of the learning, when I started to learn Flask Framework, I came across WSGI.作为学习的一部分,在开始学习Flask Framework的时候,接触到了WSGI。 After learning about the definition of WSGI, I found it similar to API as API is the middle layer between client and server and WSGI is the middle layer between web server and web app.了解了WSGI的定义后,发现和API类似,API是client和server的中间层,WSGI是web server和web app的中间层。

I was checking for the difference between both to make sure my understanding is correct however I was unable to find the answer.我正在检查两者之间的区别以确保我的理解是正确的,但是我找不到答案。 Hence I hope I will find the answer here.因此,我希望我能在这里找到答案。

WSGI is a standard interface which allows to seperate server code from the application code where you add your business logic. WSGI 是一个标准接口,它允许将服务器代码与您添加业务逻辑的应用程序代码分开。 WSGI succeeded in allowing much more freedom and innovation in the Python web space. WSGI 成功地在 Python web 空间中允许更多的自由和创新。

In WSGI applications takes a single request and returns response at a time.在 WSGI 应用程序中,一次接受一个请求并返回响应。 This single and synchronous callable limits WSGI for long lived connections like websocket connections.这个单一的同步可调用限制 WSGI 用于长连接,如 websocket 连接。 Even if we made the application asynchronous callable it only has a single path to provide request.即使我们让应用程序异步调用,它也只有一个路径来提供请求。

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. API 是 Application Programming Interface 的首字母缩写,它是一种允许两个应用程序相互对话的软件中介。 Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you're using an API.每次您使用 Facebook 之类的应用程序、发送即时消息或查看手机上的天气时,您都在使用 API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM