第43页
适兕 (业精于勤而荒于嬉。)
- 页码:第43页
MVC的概念都是这么解释的吗? Python is a fantastic language for a huge range of programming problems. 这话谁信? 下面是关于paster create -t Pylons xxx 所生成的Pylons程序的目录结构,以及主要内容的解释。 Controllers are the core of your application. They allow you to handle requests, load or save data from your model, and pass information to your view templates for rendering; they are also responsible for returning information to the browser. The model directory is for your model objects; if you’re using an object-relational mapper such as SQLAlchemy, this is where your tables, classes, and relations should be defined. public: It is similar to the htdocs directory in Apache and is where you put all your HTML, images, JavaScript, CSS, and other static files. The templates directory is where view templates are stored. The tests directory is where you can put automated unit tests for your application. The websetup.py contains any code that should be executed when an end user has installed your Pylons application and needs to initialize it. It frequently contains code to create the database tables required by your application, Controllers are the basic building blocks of Pylons applications. They contain all the programming logic and can be thought of as mini-applications. Controllers are implemented as Python classes. Each method of the class is known in Pylons as an action. On each request Pylons routes the HTTP information to a particular controller action based on the URL that was requested. The action should return a response, which Pylons passes back to the server and on to the browser. Routes is set up so that the first URL fragment after the hostname and port represents the controller and the second part represents the action. 上述描述了Pylons关于Controller的工作原理。头脑里有个清晰的认识,对于我习惯性的DataFlow理解有莫大的帮助。
适兕对本书的所有笔记 · · · · · ·
-
第43页
-
第59页
Understanding How HTTP Works ^_^,老调重弹,这是每个web开发人员必备的技能。 http://live...
说明 · · · · · ·
表示其中内容是对原文的摘抄