Integration of Django and Ajax
|Reported by:||kalnasha@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This is Anusha. I am a beginner in using Django. My project's goal is to display dynamic webpages i.e, update the page contents periodically using AJAX technology. I am getting several doubts in the process.I created an application in which I am able to query a database and display the results (http://localhost/cricketInfo/Sachin would display all Sachins profile). But I dont understand how to dynamically update these contents. Assuming that the data modifications occur frequently, so providing dynamic views is of higher priority.
My first doubt is that, I didn't understand the underlying client-server architecture i.e, what modules are comprised by the server and client respectively.
Secondly,I am using LAMP virtual machine to run my application. Once I start the server(python manage.py runserver 8000), the requests are being accepted only on local machine i.e, I am able to view output only on local machine (http://localhost:8000/cricketInfo/Sachin). I am not able to view the results from any other machine browsers(http://IP:port/cricketInfo/Sachin). Is this because, I am using a virtual machine or should I make any modifications to settings.py or so?? What should I do to make the application accessible from anywhere as www.anu.com/cricketInfo/Sachin like a website.
Thirdly, I want to make automatic updates to the page contents periodically using AJAX. For this, should we integrate our AJAX code in templates i.e, html files i.e, html files act as clientside script? Does views.py act as serverside script? If it is so, in case of dynamic updates when we make a xmlHttpRequest how does the server make out which function should be executed in the views.py? [ As the AJAX request : xmlHttp.open("GET","server-side script -- views.py",true) ]
I donno if they are very silly doubts, but I am not able to proceed further. I would be very glad if you can clarify them for me.