我按照以下步骤操作:
STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/'
... + static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT)
$(document).ready(function() { $("h1").css("background-color","red"); });
class BaseAdmin(admin.ModelAdmin): class Media: js = ['myapp/js/demo.js'] admin.site.register(MyModel, BaseAdmin)
当我打开管理网站时,没有任何改变。哪一步错了? 附:运行开发服务器" runserver"
答案 0 :(得分:0)
尝试以下几点:
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
(function ($) {
$(document).ready(function ($) {
$("h1").css("background-color","red");
});
})(django.jQuery);