![Page 1: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/1.jpg)
"
Compiled Websites with Plone, Django and SSI
Łukasz Langa"Wojciech Lichota"
![Page 2: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/2.jpg)
Agenda
Reasoning
Plone and Static Deployment
Django and SSI
Search (Xapian)
![Page 3: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/3.jpg)
Reasoning
Security solutions requiring 100% guarantee that the content cannot be edited from the Web
Performance dynamic Websites are resource hungry
Quality Assurance the ability to review complete content and functionality before every deployment
The Problem
![Page 4: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/4.jpg)
Reasoning
Security front-end/back-end division
two-level authentication
Performance throwing hardware at the problem
caching
Quality Assurance dedicated workflow environments
test instances
Existing Approaches
![Page 5: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/5.jpg)
Reasoning The Solution
Website compilation
![Page 6: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/6.jpg)
The Solution Static Deployment
Convert all Website resources to static files HTML
CSS
JS
attachments
media
Deploy the HTML on a traditional Web server ✓ orders of magnitude
better performance
✓ incredibly simple scalability
✓ server-agnostic quality assurance
![Page 7: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/7.jpg)
Static Deployment with external tools
Examples: HTTrack wget -‐-‐mirror
✓ out-of-the-box solution
✗ weak control of output
✗ slow
![Page 8: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/8.jpg)
Static Deployment with internal tools
Solutions for Plone: enpraxis.staticsite stxnext.staticdeployment
✓ much faster than external solutions
✓ fully configurable
✓ easy to customize
✗ needs integration with website
![Page 9: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/9.jpg)
Static Deployment stxnext.staticdeployment
Open-Source (ZPL)
two parts of configuration basic: for content editors
advanced: for administrators
incremental
content transformations
pluggable
integration with Xapian
![Page 10: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/10.jpg)
stxnext.staticdeployment
![Page 11: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/11.jpg)
stxnext.staticdeployment
![Page 12: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/12.jpg)
Static Deployment ...too static!
User profiles
Commenting
User communication
Search
We need something more sophisticated!
![Page 13: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/13.jpg)
The Solution Plone + Static
Deployment
Django for: User profiles
Commenting
User communication
Xapian for search
Compiled Website
![Page 14: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/14.jpg)
The Solution How to glue components together?
client-side approach: JavaScript ✓ simple implementation
✗ many requests
✗ page flickering
server-side approach: Apache SSI
✓ single request
✓ transparent to the user
✗ skin customization Compiled Website
![Page 15: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/15.jpg)
The Glue Apache mod_include (SSI)
HTML preprocessor provided by Apache httpd at least since version 1.3
Processing controlled by SGML comments
Basically enables: conditional text
inclusion of other files
inclusion of programs
printing/setting environment variables
![Page 16: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/16.jpg)
Apache m
od_include
A basic SSI element:
<!-‐-‐#element attribute=value attribute=value ... -‐-‐>
Typical elements: #include #echo #exec #set #if / #elif / #else / #endif
no whitespace
![Page 17: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/17.jpg)
Apache m
od_include
Enabling SSI in the server configuration:
... LoadModule include_module modules/mod_include.so ... AddType text/html .html AddOutputFilter INCLUDES .html ... Options +Includes
Examples of basic directives: current date on the server
<!-‐-‐#echo var="DATE_LOCAL" -‐-‐>
file modification date Last modified: <!-‐-‐#flastmod file="index.html" -‐-‐>
inclusion of results from a dynamic application <!-‐-‐#include virtual="/app-‐comments/thread/3/" -‐-‐>
executing local commands <!-‐-‐#exec cmd="uptime" -‐-‐>
![Page 18: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/18.jpg)
Apache m
od_include
Inclusion of results from a dynamic application <!-‐-‐#include virtual="/app-‐comments/thread/3/" -‐-‐>
How to specify an external application to be available from /app-‐comments ?
RewriteEngine on RewriteRule ^/app-‐comments/(.*)$ http://localhost:8686/$1 [L,P]
What if the external application is not available? Apache includes the following message by default:
[an error occurred while processing this directive]
This can be customized in server configuration by:
SSIErrorMsg "<!-‐-‐ Error -‐-‐>”
The default message can be overriden in HTML by:
<!-‐-‐#config errmsg=”Custom message" -‐-‐>
![Page 19: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/19.jpg)
Gotchas Gluing Django with SSI
context-specific arguments need to be GET params by default Django uses
URL parts
redirect after POST requests POST requests cannot
render anything
form validation requires additional plumbing
Website templating in two places Plone skin
Django templates
![Page 20: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/20.jpg)
Gotchas Apache httpd
Apache is slow...
![Page 21: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/21.jpg)
Gotchas Apache httpd
Apache is slow... NOT! mpm_prefork is evil
use mpm_worker
any experience with mpm_event?
Advantages of Apache: largest install base
maturity measured in years
the best WSGI module available (mod_wsgi)
![Page 22: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/22.jpg)
What about search? Xapian with SSI
python-‐xapian binding
Ranked search
Suggests spelling corrections
no Polish stemming
![Page 25: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/25.jpg)
"
Compiled Websites Guest Starring
Django Pony
www.djangopony.com @djangopony
![Page 26: Compiled Websites with Plone, Django, Xapian and SSI](https://reader033.vdocuments.us/reader033/viewer/2022052507/5589d65fd8b42a383b8b4716/html5/thumbnails/26.jpg)
Questions?