Remove database usage from template compilation

This allows templates to be validated without a database