Tag Archives: django

Getting “Content Security Policy” error in executing javascript with django?

Questions: I have inline javascript in my django webpage template that would dynamically fill a table. The html generated (after removing unnecessary parts) at the browser-end is the following: <html> <body> <article> <table> <tr> <td id=”apple”></td> </tr> </table> <script type=”text/javascript”> document.addEventListener(‘DOMContentLoaded’, function (){ document.getElementById(“apple”).innerHTML = “AppleText”; }); </script> </article> </body> </html> If I put the… Read More »

Django Trying to save my Array to the model

Questions: I have the following data coming from the manager_item = request.POST.getlist(manager_type_item) in my views: [‘{“id”:”1″,”title”:”Bedroom”},{“id”:”2″,”title”:”Taps”}, {“id”:”3″,”title”:”Living Room”}’] Basically each one of these are {“id”:”1″,”title”:”Bedroom”} will need t be added into the model: index = 0 for index, item in enumerate(json.loads(manager_item)): print(item[‘id’]) print(item[‘title’]) But I not 100% sure the route to go. Hope someone can… Read More »

Django server sent event not triggering HTML5 listener

Questions: I need a django template to refresh when an asynchronous event is detected on the server. I implemented this successfully using django-channels on my development server. However, the server I need to deploy to (pythonanywhere.com) doesn’t support ASGI applications, so I can’t use django-channels there. I tried to build a very simple server sent… Read More »

Django ready HTML website templates

Questions: I have Django installed along with Jinja2 and cookiecutters. I want to use some frontend templates for my website. Right now I am creating the styling by myself using Bootstrap CSS. I am aware of Bootstrap website templates but was wondering if there are any frontend templates ready for Django tags filters and so… Read More »

Django – C stack error in Django when adding rpy2

Questions: Error: C stack usage 2011331632 is too close to the limit This is what i am getting while running django project, I have no clue what to do here, the numbers are increasing on every attempt. Any quick fix to this? This started happening after adding rpy2 code in app. I have been looking… Read More »

Django to Android

Questions: I have a web application set-up with Django (Python), and I want to convert it to an Android app (.apk). Question 1 : Can I use Django (with some extra-packages) to create the .apk Question 2 : Do I have to use Android Studio ? (I’m using Atom as a Text Editor). Answers: