[GeoNode-users] Geonode and Django Content Management System

David Kennewell david.kennewell at hydrata.com
Tue Jul 5 00:21:55 PDT 2016


OK, for posterity I thought I'd report back on my experience integrating
Geonode version 2.4.dev20160701231044 and django-cms v3.3. It seems to be
working well for me, although still early days and I have no test suite so
I'm expecting a few bugs yet.

Given that this touches Apache, urls, dependencies outside of pip, and the
base templates, I don't really have an understanding about how to turn it
into a contrib app. But hopefully this will help the discussion if other
wise folk end up going down a similar path.


1. Firstly, you really need an automated build environment for this. Python
virtualenv won't save you from dependency hell, as many of the dependencies
for each are system-wide libraries. I'm using a system-wide install, using
a fresh instance each time. It will depend on how you customise DjangoCMS.
Here's what worked for me:

#DjangoCMS dependencies
sudo apt-get install python-dev python-setuptools python-pip -y
sudo apt-get install -y libqd-dev libpq-dev
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev
python-tk

#Geonode dependencies
sudo apt-get install -y python-virtualenv build-essential
openssh-server apache2 gcc gdal-bin gettext git-core
libapache2-mod-wsgi \
    libgeos-dev libjpeg-dev libpng-dev libpq-dev libproj-dev
libxml2-dev libxslt-dev openjdk-7-jre patch postgresql postgis
postgresql-9.3-postgis-scripts \
    postgresql-contrib python python-dev python-gdal python-pycurl
python-imaging python-pastescript python-psycopg2 python-support
python-urlgrabber \
    python-virtualenv tomcat7 unzip zip


The good old PIL/pillow challenges came up again during this process, but
the above works for me to resolve that.

2. I installed geonode generally in accordance with this
http://docs.geonode.org/en/master/tutorials/install_and_admin/geonode_install/index.html
And DjangoCMS generally in accordance with this
http://docs.django-cms.org/en/release-3.3.x/how_to/install.html Note to get
fuller functionality of DjangoCMS you might want to set up a separate
install using django-cms-installer
<https://github.com/nephila/djangocms-installer> and then replicate
INSTALLED_APPS and dependencies into your project. The vanilla CMS
installed by hand is very vanilla.

3. The ordering of INSTALLED_APPS is very important and takes some time and
rebuilds to get right. I found it very useful to have a standalone postgres
database (not using the one that geonode spins up on localhost), to save me
migrating models every time I tried a new build.

Here's what works for me:

https://gist.github.com/davekennewell/d4f99670396707f9ec9ec2c9636ddc08

4. Regarding Internationalisation, in ~/geonode/geonode/urls.py I simply
overrode the

from django.conf.urls import include, patterns, url

from django.conf.urls.i18n import i18n_patterns as patterns

This means that all your geonode webpages will now look like this:
http://myawesomesite.com/en/layers or http://myawesomesite.com/hi/layers
which in my case is fine because we may need the internationalisation later
anyway. But having that extra language code might be a pain for others.

But importantly now the CMS urls can simply add on as an include at the end
of geonode's urlpatterns:

url(r'^', include('cms.urls')),


5. DjangoCMS uses django-filer & easythumbnails to allow upload & storage
of images. It needs to store these in a manner similar to geonode's ~
/geonode/geonode/uploaded/thumbs directory. So you'll need to create

~/geonode/geonode/uploaded/filer_public
~/geonode/geonode/uploaded/filer_public_thumbnails/filer_public

and set the permissions and apache configuration similar to the thumbs
directory.

6. The real design work to make any of this useful is in merging the
templates and template tags. There's a bunch of choices here that are
specific for each usecase. I'd really recommend understanding how these
work in vanilla DjangoCMS before trying to merge them into your geonode
project. It's nothing super difficult, but there are many moving parts and
I've had to learn a lot here by using CMS independently, before I would
even know where to start.

OK, that's about it for now. If anyone is headed down this path, I'd be
happy to compare notes & thanks again Jesus for you work - it helped me a
lot.

cheers

Dave





David Kennewell
Water Resources Engineer
Hydrata.com
+971 55 409 7378
david.kennewell at hydrata.com


On Wed, Jun 29, 2016 at 11:57 AM, David Kennewell <
david.kennewell at hydrata.com> wrote:

> That's some great work Jesús, thanks. It's always reassuring knowing that
> a task is possible before you set out! Let me know when you've got a blog
> post up - I'd be interested to see how it looks & understand the user
> experience a bit more.
>
> It looks like I'm going to go ahead with the integration for my site -
> I'll pay attention to the challenges you've highlighted there, and let you
> know how I get on with them.
>
> I also note you're using django-cms==3.1.5.It's the latest CMS version
> (3.3) that has dropped support for django 1.6 & 1.7. I'll test out both
> options and figure out a way forward. My preference will be to use geonode
> master & djangocms3.3, to avail future upgrades, but we'll see if it works.
> It will be useful having your code to track the differences.
>
> Dave
>
>
> On Sun, Jun 26, 2016 at 10:11 PM, Jesús <gesusjl at gmail.com> wrote:
>
>> Hi all,
>>
>> I have succesfully integrated django-cms and geonode for a project
>> currently available at darwinfoundation.org/geoportal or
>> geoportal.darwinfoundation.org . Hope we can start uploading data and
>> blog posts soon. We have an internal geonode with layers, maps, and posts
>> as part of the workflow.
>>
>> There's plenty of space for further development but i needed to stop at
>> some point to cover other tasks.
>>
>> Current version of django-cms use django 1.6 and has been installed
>> manually. I have integrated djangocms-blog for multilingual post and a wiki
>> system also.
>>
>> I didn't touch the models nor views so we can benefit from geonode
>> project development . I have not developed geonode django-cms plugins but
>> should be easy enough to integrated them on geonode.
>>
>> For already published maps i use iframes to embed them on posts. The
>> workflow is quite simple. Users publish maps and editors can use those maps
>> among other resources to publish stories.
>>
>> I found no problem related with the auth system so far. Admins can use
>> the group app to give permissions to advance users.
>>
>> The code needs cleaning and would benefit from refactoring but you can
>> take a look at
>> https://github.com/jesusjl/cdfgeonode/tree/2.4.x-geonode-1.0.0.
>>
>> It's just a geonode template with customizations.
>>
>>
>> Some challenges i found on the path...
>>
>> Internationalization: I had problems with the way geonode and django-cms
>> manage internationalization. As far as i know django-cms use parler... So
>> with some hacks i was able to use both ways to handle this topic. I had a
>> lot of problems by the way geonode handle layers and maps urls, mostly 404
>> errors.
>>
>> Javascript: i had some javascript error difficult to debug when allowing
>> geonode pages be controlled by django-cms, but i was able to use
>> placeholders at the homepage. Care should be taken anyway.
>>
>> Url: I was expecting to use django i18n patterns to handle geonode urls
>> as part of django-cms but it became really cumbersome. So i just import
>> geonode url and include django-cms urls at the end. See internalization for
>> the purpose on it.
>>
>> Probably someone with more django experience could surpass all this
>> difficulties. Im sure that integrating django-cms on geonode would leverage
>> the project to a new level and probably it is worth the investment.
>>
>> Hope i can help within my means and would love to hear more on this topic.
>>
>> Jesus
>>
>> 2016-06-23 1:53 GMT-06:00 David Kennewell <david.kennewell at hydrata.com>:
>>
>>> Hi there Geonode users,
>>>
>>> I wanted to share a few developments we've made with Geonode and
>>> DjangoCMS, and learn if there are others in the community headed in this
>>> direction.
>>>
>>> For those not familiar with django-cms <http://django-cms.org> it's a
>>> tool that allows users to edit and publish content directly to a website
>>> through their browser. No coding or web developer required. A typical
>>> usecase would be a reporting publishing an article to her newspaper
>>> website.
>>>
>>> I've been working with an NGO in Chennai,India to improve the
>>> accessibility of their work around flood management, and have found the CMS
>>> a really useful tool to merge reports and Geonode spatial data together in
>>> a way that readers can engage with. Here's an example:
>>>
>>> http://chennaifloodmanagement.org/en/projects/cag-flood-inundation-mapping/
>>>
>>> To achieve this outcome, there's basically two steps. I'd be interested
>>> in collaborating with anyone who would like to get involved in either of
>>> these.
>>>
>>> *1. Integrating Geonode with DjangoCMS*
>>> Current status:
>>> I've bolted these two together with sticky tape and paper glue to
>>> demonstrate what might be possible on the Chennai project :) Currently I'm
>>> running two separate servers & databases, with hardcoded links in each
>>> project to make it look like it's all talking to each other. Apart from the
>>> dev headache, major drawback here is that users need two django accounts,
>>> one for editing reports in CMS and another for geonode. Yuk.
>>>
>>> Desired status:
>>> Integrate DjangoCMS as an app under geonode. Now that geonode is running
>>> on Django 1.8 this is should be possible. If I do go down this path (we
>>> still need some decent traction here to justify it) I'd really appreciate
>>> some guidance on how to do this in a manner that allows both easy
>>> integration for other projects, but acknowledges that this isn't the core
>>> use-case for geonode, so should be an optional extra (in my opinion).
>>>
>>> *2. Authoring geonode maps within DjangoCMS content editor. *
>>> Once you're geonode/CMS webapp is up and running, your users still need
>>> to be able to publish geonode maps from the CMS editor. I've written a
>>> plugin to enable this. Once again, it's bare-bones, but it works and we
>>> find it useful. I've pushed the code to github here:
>>> https://github.com/Hydrata/geonode_cms_map
>>> I'd be happy to write an install doc for this, but that's probably not
>>> useful until I resolve the above integration issues. Until then it's a
>>> manual deploy - feel free to reach out if you would like guidance and we
>>> can work through together - I'm sure I'd learn something from this too.
>>>
>>> That's it from me for now, I'd love to hear any similar stories or
>>> use-cases that might help guide this development in a way that's useful for
>>> all.
>>>
>>> thanks
>>>
>>> David Kennewell
>>> Water Resources Engineer
>>> Hydrata.com
>>> +971 55 409 7378
>>> david.kennewell at hydrata.com
>>> https://ae.linkedin.com/in/davekennewell
>>>
>>>
>>> _______________________________________________
>>> geonode-users mailing list
>>> geonode-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/geonode-users
>>>
>>>
>>
>>
>> --
>> Jesús
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20160705/d3ca046c/attachment-0001.html>


More information about the geonode-users mailing list