开发者

Using Mako In Windows

I plan to use wsgi + mako in Windows.

I install mako using

C:\wsgi>c:\Python26\Scripts\easy_install.exe Mako

No error. I get

Finished processing dependencies for Mako

at end of the message.

I check my Python directory, I am having the following structure :

C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\EGG-INFO
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\mako
C:\Python26\Lib\site-packages\mako-0.2.5-py2.6.egg\mako\ext

I run the following code HelloWorld.py

from mako.template import Template

def application(environ, start_response):
    status = '200 OK'

    mytemplate = Template("hello, ${name}!")
    output = mytemplate.render(name="jack")

    response_h开发者_运维知识库eaders = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

I get the following error log :

[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1]   File "C:/wsgi/HelloWorld.py", line 1, in <module>
[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1]     from mako.template import Template
[Fri Feb 05 16:11:19 2010] [error] [client 127.0.0.1] ImportError: No module named mako.template

Any advice?


a few things to try

  • make sure you're using python2.6
  • try import mako and see if you get a similar error
  • if mako imports correctly look at the value of repr(mako) and make sure it corresponds to the path you have.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜