How to include javascript in django
i am writing a django app which i would like to be very loosely coupled and reusable. i was wondering what the best practices are if your app is going to be used in a larger project, and the app relied 开发者_运维技巧on something like jquery. how do you include jquery in your app but allow it to be overridden by the very likely event that the developer of the project already has jquery for the project?
You can add it through media class.
class Media:
css = {
'all': ('/static/css/styles.css',)
}
js = ['/static/js/jquery-1.6.2.min.js','/static/js/tiny_mce.js','/static/js/jquery.autocomplete.js','/static/js/ajax_select.js',]
精彩评论