Please note that the contents
of this offline web site may be out of date. To access the most
recent documentation visit the
online version
.
Note that links that point to online resources are
green
in color and will open in a new
window.
We would love it if you could give us feedback about this material
by filling
this form
(You have to be online to fill it)
You must build the app before running it. After you build, you can test
the app locally by running it in the development server. When you are ready
to test it in App Engine production, you need to deploy it.
Building the App
You can build the Photofeed sample after you complete everything listed in
Requirements
.
To build the app:
Edit
/photo-sharing-demo/build.properties
using the
Build Properties
table below.
Build the project by invoking Ant inside the project directory as
follows:
ant init
.
Alternatively, if you want to build all the
dependencies as well, you could invoke:
ant update
If you use Eclipse, you must first modify
build.properties
to set properties as described above, and then
invoke
ant init
on the project before importing the project
into Eclipse.
Build Properties
The following are the build options that you need to set in the file
/photo-sharing-demo/build.properties
.
Property
Value
Example
sdk.dir
Set to the directory in which you installed the App Engine SDK. If this
value is missing or incorrect, the build will fail.
sdk.dir=/home/
myDir
/appengine-java-sdk-1.7.2
cloud.sql.jdbc.url:
If you use Google Cloud SQL instead of Google Cloud Storage, you must
specify the Cloud SQL JDBC URL in the format
//
instance_name
/
database_name
. If
you properly
set up your Google Cloud SQL instance
,
you can find these values in the
Google API console
.
If you don't use Google Cloud SQL, comment out this line.
jdbc:google:rdbms://test_db_instance/test_database
cloud.storage.bucket.name
If you use Google Cloud Storage, you must specify the name of the bucket
you created and permissioned as described in
Requirements
.
cloud.storage.bucket.name=shared-photos
application.id
Specify the App Engine app ID that you obtained when you
created the project
.
application.id=sample-app-1234
application.version
The default version number is 1, which should be fine. More
information on App Engine version numbering is provided in the
App
Engine documentation
.
application.version=1
application.entity.manager.factory
Specify the entity manager factory for the storage you are using. For
Google Cloud Storage, specify the value
com.google.cloud.demo.model.nosql.DemoEntityManagerNoSqlFactory
For Google Cloud SQL, specify the value
com.google.cloud.demo.model.sql.DemoEntityManagerSqlFactory
application.entity.manager.factory=com.google.cloud.demo.model.nosql.DemoEntityManagerNoSqlFactory
Running the App
After you build the app, you can run it at any time in the development
server by invoking Ant inside the project:
ant runserver
Notice the default port address (
8999
) displayed
upon successful app startup. You can change this value to any available port
number in the
/photo-sharing-demo/build.xml
file.
Browse to
http://localhost:8999
to use Photofeed.
Note:
When you run the app in the development
server, real user login via Google accounts is not performed, nor is Google
Cloud Storage actually used. (The photo data is written to a local file.) To
test those features, you need to deploy the app to production App Engine.
Deploying the App
To deploy the sample app after you successfully build it, invoke the
following command:
After deployment, you can access the application by browsing to its URL.
If you don't know what this is, you can find it in the
Admin Console
for App Engine.
(In the console's left nav pane, click Application Settings and then locate
the URL labeled
Application Default Version URL
.)