0

I'm wondering if there is a way to access REST API within the Django app.

I created a REST API using the Django rest framework. In the same project, I'm having another app in which I want to fetch data using my own rest API.

3
  • What do you mean by access REST API within the Django app? You can use the framework by importing it (import rest_framework ) in your Django project, provided you've set it up correctly Commented Jun 1, 2020 at 7:24
  • I have a Django project in which I created two apps. One for rest API and another for the web app. I want to fetch rest API data from ane to another app. Commented Jun 1, 2020 at 8:52
  • 2
    Sure, you can use the request module and make the request just like if it was an external API. But do you really need that? Why not get the data from the models directly? Commented Jun 1, 2020 at 9:49

1 Answer 1

1
  • If you want to fetch that data on the client side you need to use and make an http request in javascript.

  • 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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.