By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,714 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,714 IT Pros & Developers. It's quick & easy.

Using just the Mako part of Pylons?

P: n/a
I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
From the look of it all, the site seems to want a full Pylons
application. Is it possible to just use regular HTML files with a bit of
the Mako language embedded, or will I actually have to use all aspects
of Pylons?

In other words, can I use *just* Mako (sort of like as a replacement for
PHP) without having to use a framework?

For example, I'd like to just test out the <%include /tag and see it
in action, but the site doesn't seem to be looking for a regular HTML
file (like index.html), it seems to want a "controller". So is Pylons
overkill for just this? How would I try out *just* Mako?

Thanks!
Jun 28 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
John Salerno wrote:
I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
From the look of it all, the site seems to want a full Pylons
application. Is it possible to just use regular HTML files with a bit of
the Mako language embedded, or will I actually have to use all aspects
of Pylons?

In other words, can I use *just* Mako (sort of like as a replacement for
PHP) without having to use a framework?

For example, I'd like to just test out the <%include /tag and see it
in action, but the site doesn't seem to be looking for a regular HTML
file (like index.html), it seems to want a "controller". So is Pylons
overkill for just this? How would I try out *just* Mako?

Thanks!
Ok, I figured out how to get it to just use regular HTML files as if it
were a regular, static site. However, the include directive I used
didn't seem to work. I used:

<%include file="separate.html"/>

And it just shows that text in the browser. Am I missing something?
Jun 28 '08 #2

P: n/a
You would need a controller of some sort to connect the web request/
response with your template handling. This is the key task of the web
application layer. This is also the area that WSGI atttemps to
standardize in so far as making the basic objects framework
independent. You can thus supply a generic wsgi app to act as your
controller... see wsgiref package docs. Or, you can of course use any
app framework of your choice.

But, as a small, ultra-lightweight templating system that can be used
in a web context or as standalone, you should really take a look at
Evoque Templating: http://evoque.gizmojo.org/

All the power of any fully featured text-based templating system and
then some (no constraints on template file names or formats,
restricted execution, automatic XSS protection, ...) while being also
incredibly fast. And the simplicity of the system means you can learn
it really quickly, and remember it...

Btw, you may be interested in a small example of wsgi based app that
uses evoque -- one of the examples of how to use evoque under various
contexts:
http://evoque.gizmojo.org/ext/

mario
Jun 28 '08 #3

P: n/a
John Salerno a écrit :
I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.
Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point: you
don't need any web server to use Mako - it's just another Python package.
Jun 30 '08 #4

P: n/a
Bruno Desthuilliers wrote:
John Salerno a écrit :
>I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.

Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point: you
don't need any web server to use Mako - it's just another Python package.
Well, so far I have installed Pylons onto my web server, but a test Mako
template isn't rendering, it just prints the text to the browser.
There's got to be something more to do to get it all hooked up so that
it works.
Jul 1 '08 #5

P: n/a
John Salerno wrote:
Bruno Desthuilliers wrote:
>John Salerno a écrit :
>>I just installed Pylons onto my hosting server so I could try out
templating with Mako, but it seems a little more complicated than that.

Err... Actually, it's certainly a little less complicated than that.
First point: Mako is totally independant from Pylons. Second point:
you don't need any web server to use Mako - it's just another Python
package.

Well, so far I have installed Pylons onto my web server, but a test Mako
template isn't rendering, it just prints the text to the browser.
There's got to be something more to do to get it all hooked up so that
it works.
What do you mean by "the text"? The source code of the template? A
random insult? The generated page? If it's the last, you forgot to set a
Content-Type header.
--
Jul 1 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.