Configuring GeoNode in Development Mode¶
Before starting work on the GeoNode, you will need to have the following software installed and in your PATH:
The git command-line client, version 1.5.3 or higher:
- To verify that it is available, run git --version and verify the version is something like git version 220.127.116.11
- If not, you can download one of the installers from http://git-scm.com/ or from your operating system provider.
The GEOS geometry handling library: http://trac.osgeo.org/geos/
The GDAL geographic raster access library: http://www.gdal.org/
The OGR geographic vector data access library: http://www.gdal.org/ogr/
Sun Java Development Kit 1.5 or Higher:
- To verify that it is available, run javac -help -version and verify that it reports a list of usage flags, ending with a line like javac 1.5.0_18 (the numbers will vary with your installed version).
- If not, download from http://java.sun.com/javase/downloads/index.jsp (Make sure to install the JDK!)
- To verify that it is available, run python --version and verify that it reports a version number like Python 2.6
- If not, download from http://python.org/download/
- Python must be compiled w/ SSL support and sqlite support to support the geonode development setup. Installing the sqlite and openssl development headers before building Python will suffice.
Apache Maven 2.0.10 or Later:
To verify that it is available, run mvn -version and verify that it reports version information like:
Maven version: 2.0.10 Java version: 1.5.0_18 OS name: "linux" version: "18.104.22.168-64.fc11.x86_64" arch: "amd64" Family: "unix"
If not, download from http://maven.apache.org/download.html
Additionally, GeoNode uses a number of native-code libraries in Python. You can install these libraries manually, or allow the GeoNode setup script to compile them for you. In the latter case, you will need to install a C compiler such as GCC, as well as any requisite development libraries. GCC packages are available for Mac OSX and all Linux distributions; consult your operating system provider for installation instructions.
The native libraries needed include:
For GCC, packages are available for Mac OSX and all Linux distributions; consult your operating system provider for installation instructions. When build PIL from source, ensure that you have development libraries available for libpng, libjpeg, and libgif if you want to be able to use those formats in your GeoNode site.
If you are using Ubuntu Linux, you can configure all the above dependencies (and a few libraries useful for testing and debugging) by running the following command:
$ sudo apt-get install -y --force-yes openjdk-6-jdk $ sudo apt-get install -y vim zip unzip subversion git-core binutils build-essential python-dev python-setuptools python-imaging gdal-bin libproj-dev libgeos-dev python-urlgrabber python-nose pep8 python-virtualenv python-gdal python-pastescript postgresql-contrib libpq-dev gettext python-psycopg2 libxml2-dev libxslt1-dev $ sudo apt-get install -y --force-yes ant maven2 --no-install-recommends
The following steps should prepare a Python virtual environment for you:
$ git clone git://github.com/GeoNode/geonode.git geonode $ cd geonode $ git submodule update --init $ python bootstrap.py --no-site-packages # see note below $ source bin/activate $ paver build $ django-admin.py createsuperuser --settings=geonode.settings $ paver host
If your firewall does not allow connections to git repositories using git:// (TCP port 9418), you may connect using http://
$ git clone http://github.com/GeoNode/geonode.git geonode $ cd geonode $ git submodule init $ sed -i 's/git:\/\//http:\/\//g' .gitmodules $ git submodule sync $ git submodule update
Once fully started, you should see a message indicating the address of your geonode:
Development GeoNode is running at http://localhost:8000/ The GeoNode is an unstoppable machine Press CTRL-C to shut down
When running python bootstrap.py the --no-site-packages option is not required. If enabled, the bootstrap script will sandbox your virtual environment from any packages that are installed in the system, useful if you have incompatible versions of libraries such as Django installed system-wide. On the other hand, sometimes it is useful to use a version of the Python Imaging Library provided by your operating system vendor, or packaged other than on PyPI. When in doubt, however, just leave this option in.
$ django-admin.py createsuperuser --settings=geonode.settings
can be used to create additional administrative user accounts. The administrative control panel is not linked from the main site, but can be accessed at http://localhost:8000/admin/
Get and run geonode-client:
$ git clone git://github.com/GeoNode/geonode-client.git geonode-client $ cd geonode-client $ ant init debug
Set the GEONODE_CLIENT_LOCATION entry in src/geonode/settings.py to http://localhost:8080/ and run paver as described above.
Note that this requires ant (http://ant.apache.org/) in addition to the above build requirements.
To test the application in different browsers in VirtualBox guests, the following needs to be done before running paver host:
Start the guest in VirtualBox. Set the network adapter mode to “Host-only adapter”. Then set it back to “NAT”.
On the host, do ifconfig and write down the IP address of the vboxnet0 adapter.
Edit src/GeoNodePy/geonode/settings.py and change the line:
to use the IP address you have written down above:
Make sure to change other http://localhost urls in src/GeoNodePy/geonode/settings.py accordingly as well
To start the web server, run:
$ paver host -b 192.168.56.1
Now GeoNode is available in your browser at http://192.168.56.1:8000/
For Java Developers¶
How GeoNode Finds GeoServer¶
Java Developers can point the application at a particular GeoServer instance by setting the GEOSERVER_BASE_URL entry in settings.py to the context path of the GeoServer instance. This should include the trailing slash. For example, the GeoServer used for http://geonode.capra.opengeo.org/ is:
The default value is http://localhost:8001/geoserver/. The GeoServer module in src/geonode-geoserver-ext/ is configured to provide a GeoServer instance at that port with the following commands:
$ cd src/geonode-geoserver-ext/ $ sh startup.sh
Normally, mvn jetty:run-war would be sufficient. However, we use the shell script to add some extra parameters to the JVM command-line used to run Jetty in order to workaround a JVM bug that affects GeoNetwork.
If you want to change this service URL, edit src/geonode/settings.py and change the line below to indicate the GeoServer URL that you want to use.:
To run the Django app when Jetty is started independently, use the command below in the base of your working directory.:
$ paster serve --reload shared/dev-paste.ini
It is also possible to build the geoserver war file and deploy it into Tomcat (or another servlet container) on your development machine. To do this, excecute the following commands, then deploy the resultant war into your servlet container and configure the GEOSERVER_BASE_URL as specified above:
$ cd src/geonode-geoserver-ext/ $ mvn clean install
You will also need to configure the deployed GeoServer to find GeoNode by editing the WEB-INF/web.xml file to point to your GeoNode installation on the right port.
Alternative GeoServer Data Directories¶
This server defaults to using gs-data/ as the data directory by default. If you need you need to use an alternative data directory, you can specify it by editing startup.sh to specify a different data directory: