Friday, March 23, 2012

Update: Convert that old iPhone into a GPS Tracker

If you have not already, take a look at the previous post. This is an update on that covering my Django server side component.

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 startapp tracker
create tracker/ and tracker/ with the following code:

create tracker/templates/tracker/plot.html with the following code:

Add the following to your
(r'^tracker/(?P.*)', 'DJANGOPROJECT.tracker.views.tracker'),
(r'^plot/', 'DJANGOPROJECT.tracker.views.plot'),
Now add the APP to you INSTALLED_APPS in
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.


No comments:

Post a Comment