The Zope Bible phần 7

Thay vì phải xây dựng một sản phẩm lại instantiable đầy đủ Zope, chúng tôi chỉ đơn giản là sẽ xây dựng toàn bộ các bánh xe của ứng dụng thực phẩm trong một thư mục dưới thư mục gốc Zope. Thư mục này sẽ được gọi là "WOF", và do đó, các URL đến các ứng dụng mới sẽ được /. | 360 Part III Zope Management Setup a workspace Rather than having to build a full re-instantiable Zope product we will simply build the whole Wheel of Food application in a folder under the Zope Root Folder. This folder will be called WOF and so the URL to the new application will be your zope instance URL WOF. The first step in building the Wheel Of Food application is to create the WOF folder. Open a Web browser go to Zope s management screen and in the Root Folder create a new folder with the id of WOF. Create a new Gadfly connection The next step in building the Wheel Of Food application is to create a connection to the database that will be used. As stated earlier in this section the application will use the Gadfly database which comes bundled with Zope. From within the WOF folder select to create a new Z Gadfly Database Connection from the product drop-down list. This will bring up the Gadfly database connection add form as shown in Figure 12-6. Figure 12-6 Gadfly database connection Add screen Chapter 12 Database Management 361 In the id field enter wof_db. This is the id of the connection object we will use for the application. Select the demo data source. This is where the data in our database will be stored on the server filesystem. If you wish you can create other data sources as directed in the Add screen or you can just use demo. This is really only a problem if other people are using this Zope instance in which case there could be tables already created that could conflict with your program. Last click the Add button. This will create the wof_db Gadfly database connection object in our WOF folder so that you can begin using our database. Create the table schema The Wheel Of Food will be tracking two types of information. These are Restaurants Votes for restaurants from users Restaurants will be simply added and deleted from a list. That can be stored in a simple table containing only the names of the restaurants. Votes for restaurants need to contain

TỪ KHÓA LIÊN QUAN