1.在main函数中添加支持jsonp的包
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from pyramid.config import Configurator
#引入jsonp头文件
from pyramid.renderers import JSONP
def main(global_config, **settings):
''' This function returns a Pyramid WSGI application.
'''
config = Configurator(settings=settings)
增加回调函数
config.add_renderer('jsonp', JSONP(param_name='callback'))
config.add_route('luck_homepage','/luck_homepage')
config.scan()
app = config.make_wsgi_app()
return app
2.在对应的iew文件中
@view_defaults(route_name = 'luck_homepage')
class GoddessHomePage(View):
def __init__(self,request):
super(