Django and dash connection


I’m new to django-dash. I have a question about callbacks.

Suppose that i have a dash callback function name “get_projects”. This projects are stored in a database and there a django model for this table and and a query is written in a django view to get this data from db. How can i call this view from the dash callback function in frontend.

  1. As i think one way is, i can import that view file in frontend and call view function directly.
  2. The other option is setting up a url for this view in and call that url from the frontend callback.

Can you please explain what is the difference between above two solutions and what is the best practice for this scenario.

Thank You