简体   繁体   中英

What is the function in Django that calls base.html and how can I see python code inside base.html execute at runtime

I'm not sure if its 2 questions, but I need to see the values of my python code being executed at runtime. Can anyone tell me how this works? Does the python get executed on the client side, and if so, how can I see its values like I can for my views classes in Eclipse? I think I'm calling a js function that shows a calandar with custom python, but I'm not sure where it is so I can debug it. this is the call to the js in base.html

<script src="${url_static}js/jquery.ui.datepicker-ja.js" type="text/javascript"></script>
<script src="${url_static}js/admin/jquery-ui.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function(){$('.datepicker').datepicker();});
    </script>

Python code is executed on the server. The generated html is sent to the client. In the code you have posted {url_static} is meant to be replaced with the actual value, but probably doesn't work since django template looks for variables as {{ url_static }} . Notice the double braces.

Your datepicker isn't working since jquery isn't loaded. You can view source (or inspect element) for your rendered page and confirm if the script src is correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM