Create Multiple Versions
- Change the default version
- Make “under construction” and “latest” versions
- Hide your course from search engines
- Run Course Builder tests
- Official GAE documentation
You may want to test your course in the production environment before you make it publicly available. Rather than have a truly private course in production, you can create a separate version of the course at a related, but unpublicized, URL. The key is that GAE allows versioning of your app and provides a separate URL for each version. (For details, see Requests and Domains).
Remember that if the name of your app is MYCOURSE
, it’s available at
http://MYCOURSE.appspot.com
. You can use the version field in
app.yaml
to create and deploy a second version of the app. In this
situation, you get a separate URL for that version. For example, if you specify
version: latest
, that gets deployed to
http://latest.MYCOURSE.appspot.com
.
Assume you have two different directories on your local machine, each of which contains
code for a Course Builder course and each of their app.yaml
files has the
same value for the application parameter. If you run appcfg.py
upload in
both of these directories, GAE loads both applications to production and considers them
to be the same application.
- If the value of the
version
parameter is the same in bothapp.yaml
files, then App Engine considers there to be only one version of the application and overwrites the first one loaded with the second one. - If the value of the
version
parameter is different in theapp.yaml
files, then App Engine considers there to be two versions of the application.- The first one you upload is the default version. That version is available at
http://MYCOURSE.appspot.com
and athttp://VERSION.MYCOURSE.appspot.com
, whereVERSION
is the value of the version parameter. - The second one you upload is a non-default version. It is available only at
http://OTHERVERSION.MYCOURSE.appspot.com
, whereOTHERVERSION
is the value of its version parameter.
- The first one you upload is the default version. That version is available at
Notice that a version doesn’t have to be a number; it can be any alphanumeric string (without spaces).
Change the default version
If you do nothing special, the first version of an application that is uploaded remains
the default version (that is, the version you get when you simply enter
http://MYCOURSE.appspot.com
). Later versions do not automaically supercede
it. You can change the default version yourself:
- Visit http://appengine.google.com.
- Choose your app.
- Click Versions in the left navigation.
- Pick the radio button for the version you want to be the default.
- Click Make Default.
Make “under construction” and “latest” versions
To create an “under construction” public version as the temporary default and a “latest” hidden version as a working version, follow steps similar to the following:
- Make two directories that contain the sample app.
- Edit the
app.yaml
file in each of them. - In the directory for your temporarily public “under construction” version, specify
mycourse
as the value ofapplication
and specifyunderconstruction
as the value ofversion
. - In the directory for your working version, specify
mycourse
as the value of application and specifylatest
as the value of version. - In the under construction directory,
-
Replace the entire contents of
views/course.html
with<html><body>Really under construction.</body></html>
- Replace the text in
views/register.html
withUnder construction
.
-
- In the working version directory, do all the work you need to create your course.
- Upload both versions to production, as described in Upload your app, making the app in the under construction directory be the default version, as described above.
- Test away.
- When you’re ready to release your application, hide the “under construction” version by changing the default version to your working version, which makes that one visible.
Hide your course from search engines
To further decrease the likelihood of someone stumbling upon your course, you can
create a robots.txt
file to tell search engines such as Google’s search
engine to ignore your pages.
You add a robots.txt
file to your application by creating that file and
modifying app.yaml
to know about it.
-
Create a
robots.txt
file in the top-level of your application directory (the same place that containsapp.yaml
). Inrobots.txt
, specify:User-agent: * Disallow: /
This tells robots (such as Google’s robots that crawl the web to create its index) to ignore everything in this site.
-
In
app.yaml
, the handlers section looks like this:handlers: - url: /remote_api script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py login: admin - url: /_ah/dev_admin(/.*)? # provides interactive console script: $PYTHON_LIB/google/appengine/ext/admin login: admin secure: always - url: /.* script: main.app
Add a new entry to the top of handlers section as follows:
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
Later, when you release the course, if you want it to be findable, you should reverse
this change: remove the entry from app.yaml
and delete the
robots.txt
file.
Run Course Builder tests
Course Builder contains a set of functional tests for its source code. If you make significant changes to the source code, consider running these tests. Depending on your changes, you may also have to modify the tests.
Run the tests with the following command:
python scripts/project.py --test *
Official GAE documentation
There’s a lot of official documentation for GAE.