Changes between Initial Version and Version 1 of django_gheat


Ignore:
Timestamp:
Apr 11, 2011, 3:52:00 PM (15 years ago)
Author:
dennisw
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • django_gheat

    v1 v1  
     1== Introduction ==
     2This version of django_gheat is an edited version of [https://github.com/robertrv/django-gheat django_gheat].
     3
     4== Install Python ==
     5Get Python 2.6 from [http://www.python.org/download/ here], or:
     6{{{
     7$ sudo apt-get install python2.6
     8}}}
     9
     10== Install MySQL ==
     11Set up a MySQL server to your liking. Make sure you get version 3.23-5.1 due to the MySQLdb support. Then create a database for django_gheat.
     12
     13== Install MySQLdb ==
     14Get the latest version from [http://sourceforge.net/projects/mysql-python/files/mysql-python/ here], make sure it's higher than 1.2.1p2
     15{{{
     16$ sudo apt-get install mysql-server
     17}}}
     18
     19== Install Django ==
     20Get Django 1.3 from [http://www.djangoproject.com/download/1.3/tarball/ here] or check for a newer version [http://www.djangoproject.com/download/ here], then:
     21{{{
     22$ tar xzvf Django-1.3.tar.gz
     23$ cd Django-1.3
     24$ sudo python setup.py install
     25}}}
     26
     27== Install django_gheat ==
     28Get the latest django_gheat from the [http://svn.wirelessleiden.nl/svn/projects/Heatmap/src/ repository]
     29
     30Open /samples/persisted/settings.py, look for the 'DATABASES' section and edit the following lines:
     31{{{
     32# If you are using MySQL with MySQLdb, don't edit this line.
     33# If you are using a different database, replace 'mysql' with 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
     34'ENGINE': 'django.db.backends.mysql',
     35# The name of your database, or the path to your database file if you are using sqlite3.
     36'NAME': ' ',
     37# Connection settings for your database. Not used with sqlite3
     38'USER': ' ',
     39'PASSWORD': ' ',
     40'HOST': ' ',
     41'PORT': ' ',
     42}}}
     43
     44Once you've entered the correct settings, you will be able to start Django.
     45{{{
     46$ cd django_gheat/samples/persisted
     47
     48# The following command will add some standard Django tables and the tables defined in django_gheat/gheat/models.py to the database
     49$ python manage.py syncdb
     50
     51$ python manage.py runserver
     52}}}
     53Something like this should return:
     54{{{
     550 errors found
     56Django version 1.3, using settings 'persisted.settings'
     57Development server is running at http://127.0.0.1:8000/
     58Quit the server with CONTROL-C.
     59}}}
     60
     61You will now be able to browse to the location where the dev server is running. Add 'home/' to the address and a map will be displayed where heatmap tiles will be generated realtime.
     62
     63== Populating the database ==
     64The 'syncdb' command added the following tables to the database:
     65{{{
     66BEGIN;
     67CREATE TABLE `gheat_accespoint` (
     68    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     69    `mac` varchar(17) NOT NULL,
     70    `ssid` varchar(64) NOT NULL,
     71    `encryptie` bool NOT NULL
     72)
     73;
     74CREATE TABLE `gheat_gebruiker` (
     75    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     76    `gebruiker` varchar(64) NOT NULL,
     77    `apparatuur` varchar(64) NOT NULL
     78)
     79;
     80CREATE TABLE `gheat_meting` (
     81    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     82    `accespoint_id` integer NOT NULL,
     83    `gebruiker_id` integer NOT NULL,
     84    `lat` double precision NOT NULL,
     85    `lng` double precision NOT NULL,
     86    `signaal` integer NOT NULL,
     87    `datum` datetime NOT NULL
     88)
     89;
     90ALTER TABLE `gheat_meting` ADD CONSTRAINT `gebruiker_id_refs_id_56605efc` FOREIGN KEY (`gebruiker_id`) REFERENCES `gheat_gebruiker` (`id`);
     91ALTER TABLE `gheat_meting` ADD CONSTRAINT `accespoint_id_refs_id_49f1ad5c` FOREIGN KEY (`accespoint_id`) REFERENCES `gheat_accespoint` (`id`);
     92COMMIT;
     93}}}
     94Note that on this moment only the gheat_meting(lat, lng, signaal) are used for generating heatmaps, so make sure you atleast put some data in those columns.
     95
     96== Prerender heatmap ==
     97You can prerender a heatmap with the following command:
     98{{{
     99$ cd django_gheat/samples/persisted
     100$ python manage.py gen_tiles
     101}}}
     102This will prerender a heatmap with the default boundingbox specified in django_gheat/gheat/management/commands/gen_tiles.py
     103To use a different boundingbox or colorscheme, you can customize the command:
     104{{{
     105# -s = start of the boundingbox, SW corner
     106# -e = end of the boundingbox, NE corner
     107# -c = colorscheme located in django_gheat/gheat/etc/color-schemes/
     108# -b = view used for creating tiles, default should be fine
     109
     110$ python manage.py gen_tiles -s 60,6 -e 66,8 -c firetrans -b serve_tile
     111}}}
     112
     113== Troubleshooting ==
     114If something is unclear or isn't working as it should, feel free to create a ticket.