| | 1 | {{{ |
| | 2 | #!text/x-rst |
| | 3 | ======================================== |
| | 4 | Preparing an Oracle GeoDjango test setup |
| | 5 | ======================================== |
| | 6 | |
| | 7 | Since GeoDjango requires full featured Oracle installation instead of XE this document |
| | 8 | is meant to ease up installation and testing GeoDjango parts. |
| | 9 | |
| | 10 | ============== |
| | 11 | Prerequisities |
| | 12 | ============== |
| | 13 | |
| | 14 | Install Oracle client and set it up as documented in https://docs.djangoproject.com/en/1.4/ref/databases/#oracle-notes |
| | 15 | Install GeoDjango requirements as documented in https://docs.djangoproject.com/en/1.4/ref/contrib/gis/install/ |
| | 16 | |
| | 17 | ====================== |
| | 18 | How to get full Oracle |
| | 19 | ====================== |
| | 20 | |
| | 21 | Easiest way is to use Oracle VirtualBox with prebuilt Oracle installation VM. |
| | 22 | |
| | 23 | #. Download and install **Oracle VirtualBox** from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html or use package manager from your system. |
| | 24 | |
| | 25 | #. Download **Oracle Developer Day** image from http://download.oracle.com/otn/other/virtualbox/dd/Oracle_Developer_Day.ova |
| | 26 | |
| | 27 | **NOTE: You may not use Oracle Developer Day VM for any other purposes than testing** |
| | 28 | |
| | 29 | ============== |
| | 30 | Database setup |
| | 31 | ============== |
| | 32 | |
| | 33 | #. Create a user and give the needed privileges:: |
| | 34 | |
| | 35 | $ sudo su oracle |
| | 36 | $ sqlplus / as sysdba |
| | 37 | SQL> CREATE USER djangotest IDENTIFIED BY djangotest; |
| | 38 | SQL> GRANT DBA TO djangotest; |
| | 39 | SQL> quit |
| | 40 | $ exit |
| | 41 | |
| | 42 | ========= |
| | 43 | Run tests |
| | 44 | ========= |
| | 45 | |
| | 46 | #. Create geodjango_oracle.py settings file:: |
| | 47 | |
| | 48 | TEST_RUNNER = 'django.contrib.gis.tests.GeoDjangoTestSuiteRunner' |
| | 49 | |
| | 50 | DATABASES = { |
| | 51 | 'default' : { |
| | 52 | 'ENGINE' : 'django.contrib.gis.db.backends.oracle', |
| | 53 | 'PORT' : '1521', |
| | 54 | 'HOST' : '192.168.56.101', |
| | 55 | 'NAME' : 'orcl', |
| | 56 | 'USER' : 'djangotest', |
| | 57 | 'PASSWORD' : 'djangotest', |
| | 58 | }, |
| | 59 | } |
| | 60 | |
| | 61 | #. Run tests:: |
| | 62 | |
| | 63 | django-admin.py test --settings=geodjango_oracle |
| | 64 | }}} |