Presentation is loading. Please wait.

Presentation is loading. Please wait.

Working with Databases (II) 靜宜大學資管系 楊子青

Similar presentations


Presentation on theme: "Working with Databases (II) 靜宜大學資管系 楊子青"— Presentation transcript:

1 Working with Databases (II) 靜宜大學資管系 楊子青 2013.4.22.

2 Creating a Custom TinyWebDB Service
TinyWebDB is an App Inventor component that allows you to store data persistently in a database on the web. By default, the TinyWebDB component stores data on a test service provided by App Inventor, . This service is helpful for testing, but it is shared by all App Inventor users, and it has a limit of 1000 entries. If you use it, your data will be overwritten eventually. For most apps you write, you'll want to create a custom web service that isn't shared with other App Inventor apps and programmers.

3 To create your own web service
Follow these instructions: Download App Engine for Python at . (之前需先下載Python) After installing it, run the GoogleAppEngineLauncher by clicking its icon. Download this sample code and Unzip the downloaded zip file. It is a zip file containg the source code for your custom tinywebdb web service. (檔案有問題,改找appinventordb.zip) In the GoogleAppEngineLauncher, choose File | Add Existing Application . Browse to set the Path you just unzipped. Then click the Run button. This will launch a test web service that runs on your local machine. You can test the service by opening a browser and entering “localhost:8080” as the URL. You‘ll see the web page interface to your web service. (如果瀏覽器無法顯示,也沒有關係)

4 To create your own web service (Cont.)
Follow these instructions: Your app is not yet on the web. You need to upload it to Google's App Engine servers. In the GoogleAppEngineLauncher, choose Dashboard . Enter your Google account information and you'll be taken to an App Engine dashboard. Choose Create an Application . You'll need to specify a globally unique Application Identifier. Provide a name to your app and click Create Application to submit. Edit the file app.yaml. Modify the first line so that the application matches the application identifier In GoogleAppEngineLauncher, choose Deploy and follow the steps. Test to see if your app is running on the web. In a browser, enter myapp.appspot.com, only substitute your identifier for "myapp". It’s on the web and you can access it from your App Inventor for Android app.

5 To create your own web service (Cont.)
Follow these instructions: Your App Inventor apps can store and retrieve data using your new service. Just do the following: Drag in a TinyWebDB component into the Component Designer. Modify the ServiceURL property from the default to your web service. Any StoreValue operations (blocks) will store data at your service, and any GetValue operations will retrieve from your service.

6 1. 下載Python 2.7.4版

7 安裝Python 2.7.4版

8 2. 下載及解壓縮appinventordb.zip

9 3.下載Google App Engine SDK for Python

10 安裝Google App Engine SDK

11 安裝後,Launch應用程式

12 4. 加入應用程式

13 設定應用程式路徑

14 Run應用程式,再Browse於瀏覽器 以Local端執行

15 於Local端執行,有可能無法顯示 不過沒有關係

16 5. Dashboard應用程式到雲端

17 建立應用程式

18 設定應用程式Identifier與Title

19 應用程式註冊成功

20 編輯應用程式

21 修改app.yaml的application值

22 6. 部署(Deploy)應用程式至雲端

23 部署過程

24 7.開啟瀏覽器,連至自己設定的 網路資料庫服務 (_.appspot.com)

25 直接輸入Tag與Value進行測試

26 查詢Tag貯存的Value值

27 8.於App Inventor修改TinyWebDB 服務網址(ServiceURL屬性)

28 執行測試程式

29 透過程式,已將資料存入自己設定的專屬網路資料庫


Download ppt "Working with Databases (II) 靜宜大學資管系 楊子青"

Similar presentations


Ads by Google