Django : Is it a good idea to generate JS dynamically?

后端 未结 5 2105
北恋
北恋 2021-02-03 12:23

When I write my JS files for a Django project, of course I do some AJAX calls, and for the moment the urls for those calls are hard-coded (which is very ugly).

I was thi

5条回答
  •  忘了有多久
    2021-02-03 13:01

    Nowadays, the best way to do this is to use Django.js

    Here is the doc where they talk about the URL reversing: http://djangojs.readthedocs.org/en/0.8.1/djangojs.html#reverse-urls

提交回复
热议问题