Note: This makes sense only if you want to ship a custom dojo build with your Plone application or if you find it slow and annoying to go get dojo from one of the CDNs. If you don’t have a custom dojo build (if you don’t know what I am talking about, then you certainly don’t need one) just get dojo from the CDN – works beautifully with Plone.
We recently had to integrate the amazing dojo toolkit with Plone. The problem we encountered was pretty simple – Plone does not serve any files/objects etc which have their names starting with an underscore character ‘_’. Dojo has plenty of javascript modules beginning with ‘_’.
The existing solutions ranged from the brute force to the exotic and excessive.
The solution we settled down to (after a little bit of thinking) is to setup dojo behind apache and serve the files from there. Here’s how to do it.
- Get the dojo sdk
- extract it to a directory like /home/xxx/dojo and do a cross domain build (see dojo documentation on how to do this).
- Setup apache if you haven’t already done this. Don’t be scared – setting up apache these days just means installing the package from your favorite distribution.
- Open up /etc/apache2/apache2.conf (This is where it resides on my ubuntu server) and add the following at the end
Alias /dojo/ "/home/xxx/dojo/" <Directory "/home/xxx/dojo"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>
That will setup your dojo files to be served to the localhost – for development purposes it is ok. You can eventually change it to serve your intranet/internet users as well.