In the first part we created a simple python script which announced the GPS co-ordinates of the device to a web server. So to complete the solution we will do the following.
- Create a model and view to store posted tracker co-ordinates
- Create a view to visualize the data with google maps API
I won't cover setting up django itself, there are plenty of good docs on the django site for that. Once you have django up and running create a new application therein like this:
python manage.py startapp tracker
create tracker/models.py and tracker/views.py with the following code: http://pastebin.com/0rxDhaX5
create tracker/templates/tracker/plot.html with the following code: http://pastebin.com/T3ACVDpY
Add the following to your urls.py
(r'^tracker/(?P.*)', 'DJANGOPROJECT.tracker.views.tracker'),(r'^plot/', 'DJANGOPROJECT.tracker.views.plot'),
Now add the APP to you INSTALLED_APPS in settings.py
'DJANGOPROJECT.tracker',
Now the python app on the device will be able update the location models in the django application. And you will be able to view the current position via the /plot/ url.
Kegan