简体   繁体   English

Django-REST-Framework REST API Z2B9AFB89A6ACC1575B159BCA38D10ADZ 应用程序内

[英]Django-REST-Framework REST API within django app

I'm wondering if there is a way to access REST API within the Django app.我想知道是否有办法在 Django 应用程序中访问 REST API。

I created a REST API using the Django rest framework.我使用 Django Z65E8800B5C6800AAD896F888B2A2 框架创建了 REST API。 In the same project, I'm having another app in which I want to fetch data using my own rest API.在同一个项目中,我有另一个应用程序,我想在其中使用我自己的 rest API 获取数据。

  • If you want to fetch that data on the client side you need to use and make an http request in javascript .如果您想在客户端获取该数据,您需要在javascript中使用并发出 http 请求。

  • If you want to fetch that data on the server side you already have the data, no need to fetch from the api, if you really need to do that there is the requests module.如果您想在服务器端获取该数据,则您已经拥有数据,无需从 api 获取,如果您确实需要这样做,则可以使用requests模块。

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

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