Opened 4 years ago

Last modified 18 months ago

#30296 new New feature

Add how-to guide for JavaScript frameworks integration

Reported by: Maciej Olko Owned by:
Component: Documentation Version:
Severity: Normal Keywords: javascript, rest, api, assets
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Question "How do I get Django and my JS framework to work together?" is common question being searched on the Internet {1}{2} so it should be vital to have at least introduction to this topic in Django's documentation.

How-to guide would consist of two parts (B and C original descriptions by Ayeric Augustin {3}):

  1. Consider brief introduction how to make JSON response, what is a REST API and link to API creation Django Packages grid?
  1. Singe Page App model description — where Django only serves the API

We would need to explain CORS and CSRF in the clearest terms possible. Many devs end up shotgun-debugging CORS or CSRF errors, which always results in insecure deployments. (…) Perhaps a condensed version of Django React SPA Aymeric's blog post {4} could do the job? (…)

  1. Description of integrating a modern JS framework with django.contrib.staticfiles

(…) The docs should at least give the general idea of "compile your frontend to somewhere Django can find the files, then run collectstatic".

Discussion on django-developers:



Change History (6)

comment:1 Changed 4 years ago by Carlton Gibson

Triage Stage: UnreviewedAccepted

Accepting, yes. This kind of guide would be great I think. (I guess the difficulty is pitching it exactly right, but that's implementation... 🙂)

comment:2 Changed 4 years ago by Josef Rousek

Owner: changed from nobody to Josef Rousek
Status: newassigned

comment:3 Changed 3 years ago by Tapasweni Pathak

Hello folks: Can I take the ticket or the ticket is for internal folks?

comment:4 in reply to:  3 Changed 3 years ago by Josef Rousek

Replying to tapaswenipathak:

Hello folks: Can I take the ticket or the ticket is for internal folks?

Hi there. Feel free to take it. I created a repo with basic guide, but haven't got back.

comment:5 Changed 19 months ago by Mariusz Felisiak

Owner: Josef Rousek deleted
Status: assignednew

comment:6 Changed 18 months ago by Thomas Güttler

I think the first step would be to focus on how to get a library which you can install via npm integrated into Django.

CORS, APIs, DRF ... are a different topic (and I think it is out of scope)

But I think this should be documented:

Imagine you want to integrate a simple npm installable JS library like:

It is not that super simple, because above library has a dependency.

The task is not really hard. But up to now everybody does it in a different way. It would be nice to have
a simple default way of integrating npm installable JS libraries.

Note: See TracTickets for help on using tickets.
Back to Top