codecamp

Important Terms

Important Terms

This page covers important terms used in the documentation and Werkzeugitself.

WSGI

WSGI a specification for Python web applications Werkzeug follows. It wasspecified in the PEP 333 [http://www.python.org/dev/peps/pep-0333] and is widely supported. Unlike previous solutionsit gurantees that web applications, servers and utilties can work together.

Response Object

For Werkzeug, a response object is an object that works like a WSGIapplication but does not do any request processing. Usually you have a viewfunction or controller method that processes the request and assambles aresponse object.

A response object is not necessarily the BaseResponse object or asubclass thereof.

For example Pylons/webob provide a very similar response class that canbe used as well (webob.Response).

View Function

Often people speak of MVC (Model, View, Controller) when developing webapplications. However, the Django framework coined MTV (Model, Template,View) which basically means the same but reduces the concept to the datamodel, a function that processes data from the request and the database andrenders a template.

Werkzeug itself does not tell you how you should develop applications, but thedocumentation often speaks of view functions that work roughly the same. Theidea of a view function is that it's called with a request object (andoptionally some parameters from an URL rule) and returns a response object.

HTTP Proxying
Werkzeug Changelog
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }