Skip to main content

Mako tool for cherrypy

Project description

CherrypyMako is a cherrypy plugin that provides Mako template engine , within cherrypy as a tool.

Example:

demo.py:

import os.path
import cherrypy
import CherrypyMako
import datetime
CherrypyMako.setup()
root_dir = os.path.abspath( os.path.dirname(__file__))

class Root(object):

    @cherrypy.expose
    @cherrypy.tools.mako(filename='index.html')
    def index(self):
        return {'currentTime':datetime.datetime.now()}


_cp_config={
    'global':{
        'server.socket_host'  : '0.0.0.0',
        'server.socket_port'  : 1919,
        'tools.mako.directories' : [os.path.join(root_dir,'templates')],
    },
}

if __name__ == '__main__':
    cherrypy.quickstart(Root(), '', config=_cp_config)

index.html:

<html>
        <head>
                <title>Cherrypy Mako Tool Demo</title>
        </head>
        <body>
                ${currentTime}
        </body>
</html>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CherrypyMako-0.3.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

CherrypyMako-0.3.1-py2.7.egg (4.1 kB view details)

Uploaded Source

File details

Details for the file CherrypyMako-0.3.1.tar.gz.

File metadata

File hashes

Hashes for CherrypyMako-0.3.1.tar.gz
Algorithm Hash digest
SHA256 433bb9ff2558fe36bc4a51adeb739e6d6c2a61a86ec1d81fcd47e29928e88f2e
MD5 27213b0d6a1801840b42b2ac9d2ef080
BLAKE2b-256 604da80f62ccd0b389c97792fadce6220a5810bd9ed15cde986275958fa7ff1e

See more details on using hashes here.

File details

Details for the file CherrypyMako-0.3.1-py2.7.egg.

File metadata

File hashes

Hashes for CherrypyMako-0.3.1-py2.7.egg
Algorithm Hash digest
SHA256 ede396b8233c739d3dd455a9cf7d7a352e7e4cd517b8bd46fc3dc99813277a72
MD5 991d81747cfd55f7b19080da3d867c72
BLAKE2b-256 b2da2d169b4006d6323c452f10427f805f0bb93c427cc64147a0880c291be054

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page