News Examples Installation project page Doxygen Pydoc Epydoc

Step-by-step installation guide for Django-dataplot

Django-dataplot is a package that links the Django web programming framework together with any of several graphical plotting programs. There are quite a few dependencies required for a working django-dataplot installation, and this guide is meant to address the problem of installing all of these dependencies.

The goal of these installation tutorials is to achieve a fully-functional demonstration of the demo soccer and bike apps, starting from a virgin system.


We will assume you do NOT have administrator privileges on the system, so all software will be installed under the user's home directory (in all the examples we use the username thocking).

Python Tell the windows installer to place python in C:\Documents and Settings\thocking\Python25. You probably want to add C:\Documents and settings\thocking\Python25 to the windows PATH (Control Panel - Performance and Maintenance - System properties - Advanced - Environment variables). At this point you should be able to call up a windows shell and type python to get a python shell.

Django if you have problems with opening the tgz file you can use 7zip. Put the django subdirectory in your python25\lib\site-packages directory. At this point you should be able to do an "import django" at the python command line. Next you probably want to add django\bin to your PATH so you can use Then open up a windows shell and do a " startproject proj" to start a test project. You should then be able to "cd proj" and then " runserver" to start the test server. Look at localhost:8000 with a web browser to see the django test page. Open up a text editor and edit and set DATABASE_ENGINE='sqlite3' and DATABASE_NAME to a sensible filename for the sqlite database, for example DATABASE_NAME = 'c:/Documents and Settings/thocking/proj/db.sqlite3'. In the middle of the file you should fill in MEDIA_ROOT='c:/Documents and Settings/thocking/proj/media' and MEDIA_URL='/m/' (it is important that MEDIA_URL is not the same as ADMIN_MEDIA_URL). Scroll to the bottom of and add 'dataplot','','','django.contrib.admin' to INSTALLED_APPS. At this point save the file and the test server should stop running, complaining about the fact that we haven't installed dataplot yet. Let's do that.

Django-dataplot download the .tgz and copy the dataplot directory to your python25\lib\site-packages directory. At this point if you restart the test server it should give you an Error, that's because the Python Imaging Library is required by django-dataplot. Download and install now, just click through the installer, it should put the files where they need to go (in python25\lib\site-packages). Now restarting the test server should work but loading up the soccer main page should still be the django test page, that's because we haven't defined any URLconfs. In a text editor add

(r'^%s(?P<path>.*)$'%settings.MEDIA_URL[1:], # serves the plot files
  'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

to the urlpatterns in proj\ (also add "from django.conf import settings") and then you should be able to reload the server and see an error page complaining about data tables. Do a " syncdb" to fix that, then restart the server, then reload the soccer main page, and it should start loading the default data set into the database (as noted in the testing server shell by lines starting with a date). And after all the data is loaded, you should see the soccer homepage load up. At this point you have a functional django project running on your test server, but dataplot has no backend plot modules installed. Thus when you click on the link to the plot page, you will get a PlotError. Let's fix that by installing RPy, the django-dataplot plotting backend that is used in all the plots in the app.

R install to your home directory as usual. Add R-2.6.2\bin to your PATH and then you should be able to use R from the windows shell by simply typing R.

Python for windows extensions and RPy which are required for the Rpy backend. Just click through the installation, it should auto-detect your python installation and put the files in python25\lib\site-packages. At this point RPy should be fully functional, so you can fire up a shell and try a "from rpy import r" and then "r.plot(r.rnorm(100))", for example, to make sure RPy is working. At this point you should have all the software necessary to browse the soccer website. Get the test server running and go to the plots page. If you see the plots, congratulations, you have a successful django-dataplot-rpy install!

Matplotlib is another backend for django-dataplot (Numpy is required). The bike app uses it to make 1 plot. The installer should auto-detect your python installation and install the correct modules in python25\lib\site-packages. After installing, load up the bike app and see if the matplotlib plot with blue dots shows up on the page, underneath the correlation by day heading. FIXME: this should work (works fine on linux) but when I tried it, the python interpreter running the test server on the windows system that I was using crashed.


On linux-based systems, django-dataplot installation should be substantially easier. Make sure to install all the required packages: Python 2.5, Django 1.0.2, R 2.6.2, RPy 1.0.3, Numpy 1.3.0, Python Imaging Library 1.1.6, and Matplotlib. Be careful to match version numbers with the ones listed above for the windows distribution. These are the only versions guaranteed to work, and often changing a package version will cause the system to break. That being said I usually use the development versions of django and RPy, so those should work as well.

Hosted by SF-Logo