12
Felipe Pollola Paulo Vitor

Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

Embed Size (px)

Citation preview

Page 1: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

Felipe Pollola

Paulo Vitor

Page 2: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

MVC (Model-View-Controller);

About TurboGears;

TurboGears Installation;

Creating a Project;

Starting a Project;

Implementing basic configurations to a Project;

References.

2

Page 3: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

3

Applications default architecture, also used in design-patterns, meaning an easily communication, documentation and systems learning.

The vision is to separate logic application (Model Layer), of interface

to user (View Layer) and of application flux (Controller Layer).

Permits that the same business logics can be accessed and seen by

various interfaces.

Page 4: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

4

Model: Model represented in a project low level structure. Could be an object-relational model that implements the data layer, or in interface MVC case, it could store state informations of controllers.

Controller: Implements the layer responsible to manage events in

the project, like: User clicks that call the Model layer to process events.

Also it can store state informations of user in the application.

View: Generate an user interface in agreement to request the

processing of events in Controller Layer.

Page 5: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

5

TurboGears components:

* MochiKit: JavaScript library ;

* Kid: Templating language;

* CherryPy: Base Web framework;

* SQLObject: Object-relational mapper (ORM).

Examples of Companies that uses it:

* IBM;

* Adobe.

Page 6: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

6

The installation guide of TurboGears can be found in Twiki.

Link: http://twiki.on.br/bin/view/DEV/TurboGears

Page 7: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

7

It recommends that the developer creates a folder base to store the TurboGears created projects.Example: /home/{username}/Turbogears

Situated in destiny folder, execute the command tg-admin quickstart to create a new project in aggreement with decisions of the creator. Example: /home/[username]/Turbogears

{username}@{hostname}:~/Turbogears> tg-admin quickstart

Page 8: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

8

Thus that executing command, automatically it will, at console, work all processes to project creation.Example: {username}@{hostname}:~/Turbogears> tg-admin quickstart

Enter project name:

Then, set a project name; the packet can be the same

name of project; a Identity means that TurboGears will

be able to supply the prepared code to that kind of

solution, like authentication and authorization (“Not

using” it is the standard given). After this, your project

will be created in the folder defined before.Example: /home/{username}/Turbogears/{project_name}

Page 9: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

9

It's possible to initiate the operations with the TurboGears using standard configuration. For this, type in your console in the previously cited folder this command: ./start-{project_name}.py ou python start-{project_name}.py

Example: /home/{username}/Turbogears/{project_name}/python start-{project_name}.py

Page 10: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

10

For recommendation, the ideal is not to keep the standards configurations of the TurboGears. Because, for example, the port used for your project in the TurboGears can be being used by another applicattion then causing an error.Example: Exception in thread CPHTTPServer Thread-2:

error: (13, 'Permission denied')

Then to configure this type of situation in TurboGears it's necessary to

edit “dev.cfg” located in the origin folder of the project (project name),

and go to the written line as “SERVER” in “# server.socket_port=8080”

to choose for which port will have to transmit the information desired,

removing the commentary of the line.

Page 11: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

Some other disabled standards can be modified in this configuration archive and enabled, such which: DATABASE, LOGGING, etc.

After this, initiates the project above TurboGears as guided, and goes

to the name folder [project name] referenced in the origin folder.

11

Page 12: Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing

12

WebSites: TurboGears Official Site - http://www.turbogears.org/

O TurboGears - http://oturbogears.org/

Portuguese Discussion Group of TurboGears -

http://br.groups.yahoo.com/group/turbogears-pt/

TG Documentation - http://tg.maetico.com/api/