Preferable JS's coding style for the Django.

40 views
Skip to first unread message

Seti Volkylany

unread,
Jul 4, 2016, 1:56:09 PM7/4/16
to Django users
In the Web have many a variants for JS style coding. The Django give less detail about good JS coding (see https://docs.djangoproject.com/en/1.9/internals/contributing/writing-code/javascript/#code-style).
What experts can advise on this issue?

James Schneider

unread,
Jul 6, 2016, 1:00:44 AM7/6/16
to django...@googlegroups.com
The reason that there is little documentation regarding a combination of Django and JavaScript is because they are almost entirely independent of each other. You can write entire projects in JS without touching Django, and you can write entire Django projects without touching JS.

Exactly "how" you write and format your JS is up to you. I see you've found several examples. I would suggest trying them all to find one that "feels" right to you.

Keep in mind that much, if not all, of your JS code will not be served by Django, but rather by the underlying web server process such as Apache or Nginx. Django doesn't even know or care that it exists.

When the two do interact, most commonly JS is used to retrieve data (usually in JSON) from Django views, but even then, Django does not do anything special with the JS code itself.

-James

Reply all
Reply to author
Forward
0 new messages