Using just the Mako part of Pylons?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Salerno

    #1

    Using just the Mako part of Pylons?

    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!
  • John Salerno

    #2
    Re: Using just the Mako part of Pylons?

    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?

    Comment

    • mario

      #3
      Re: Using just the Mako part of Pylons?

      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:
      Descriptions, examples for using Evoque Templating with other systems.


      mario

      Comment

      • Bruno Desthuilliers

        #4
        Re: Using just the Mako part of Pylons?

        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.


        Comment

        • John Salerno

          #5
          Re: Using just the Mako part of Pylons?

          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.

          Comment

          • Matt Nordhoff

            #6
            Re: Using just the Mako part of Pylons?

            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.
            --

            Comment

            Working...