Skip to content

Commit

Permalink
reformatting and small edits to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Dirolf committed Mar 19, 2009
1 parent 4f8872c commit ae65656
Showing 1 changed file with 30 additions and 62 deletions.
92 changes: 30 additions & 62 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,40 @@ group <http://groups.google.com/group/mongodb-user>`_.
Usage
=====

Follow the following steps to get Google AppEngine working with MongoDB.
The following steps can be used to get Google AppEngine working with MongoDB:

Install MongoDB
---------------

Instructions for installing MongoDB on your platform can be found on `the mongodb site <http://www.mongodb.org>`_.

After installing, start an instance of **mongod** on the default port::

$ mongod run

Get the Google AppEngine Code
-----------------------------

In order to use the adapter, you must patch the AppEngine source distribution, which can
In order to use the connector, you must patch the AppEngine source distribution, which can
be found `here <http://code.google.com/p/googleappengine>`_ and checked out via::

$ svn checkout http://googleappengine.googlecode.com/svn/trunk/ googleappengine-read-only
$ svn checkout http://googleappengine.googlecode.com/svn/trunk/ googleappengine-read-only

Be sure that you meet all the pre-requisites listed in the *README* in the resulting
directory.

Patch the AppEngine Code
------------------------

Patches are found in the *gae_patches/* directory and are stored by
svn revision number. To find the revision number of the respository
svn revision number. To find the revision number of the repository
that you checked out, go into the root of the repository and type::

$ svn info

Be sure that you meet all the pre-requisites listed in the READM in the AE
directory, and also be sure that you have MongoDB installed and running.

Patch the AppEngine code
------------------------

This adapter has been tested against revision 41 from Google
AppEngine's svn repository. The following patch (generated by `svn
diff`) shows how to modify the AppEngine code in order to use MongoDB::

Index: dev_appserver.py
===================================================================
--- dev_appserver.py (revision 41)
+++ dev_appserver.py (working copy)
@@ -37,6 +37,7 @@
SCRIPT_DIR = os.path.join(DIR_PATH, 'google', 'appengine', 'tools')

EXTRA_PATHS = [
+ "PATH/TO/MONGO-APPENGINE-CONNECTOR/DIRECTORY",
DIR_PATH,
os.path.join(DIR_PATH, 'lib', 'antlr3'),
os.path.join(DIR_PATH, 'lib', 'django'),
Index: google/appengine/tools/dev_appserver.py
===================================================================
--- google/appengine/tools/dev_appserver.py (revision 41)
+++ google/appengine/tools/dev_appserver.py (working copy)
@@ -75,7 +75,7 @@
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import appinfo
from google.appengine.api import datastore_admin
-from google.appengine.api import datastore_file_stub
+import datastore_mongo_stub
from google.appengine.api import mail_stub
from google.appengine.api import urlfetch_stub
from google.appengine.api import user_service_stub
@@ -3001,7 +3001,7 @@

apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()

- datastore = datastore_file_stub.DatastoreFileStub(
+ datastore = datastore_mongo_stub.DatastoreMongoStub(
app_id, datastore_path, history_path, require_indexes=require_indexes)
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore)

The path added to *dev_appserver.py* should be replaced with the path
where this directory is located on your machine. This patch should then be
applied against a clean version of the AppEngine svn repository. To apply the patch, do
the following from a command line, assuming that you've checked out the source as a
read-only repository::
AppEngine's svn repository. To apply the patch, do
the following from a command line::

$ cd googleappengine-read-only
$ patch -p0 < gae_patch_r41.txt
Expand All @@ -98,8 +67,8 @@ If you see no error messages, your patching was successful.
Set the MongoDB Connector Directory
-----------------------------------

In the AE distribution, we patched *dev_appserver.py* in the previous step, and now we
need to edit it by hand. Open the file in your favorite editor, and look for the line
In the AppEngine distribution, we patched *dev_appserver.py* in the previous step, and now we
need to edit it by hand. Open the file in your favorite editor, and look for the line::

"PATH/TO/MONGO-APPENGINE-CONNECTOR/DIRECTORY"

Expand All @@ -110,24 +79,24 @@ Install PyMongo, the Python Driver for MongoDB

If you've already installed the MongoDB python driver - PyMongo - you can skip this step.

To install PyMongo :
To install PyMongo::

$ easy_install pymongo

Run the Tests
-------------

Once AE is patched, pymongo is installed, and MongoDB is up and running, you can test
Once AppEngine is patched, pymongo is installed, and MongoDB is up and running, you can test
the installation by running the adapter's unit tests.

To do so, simply start AE via the SDKs start script *dev_appserver.py* with the full path to the
test/test_site directory in the adapter distribution. So, starting in the root of the
AE SDK :
To do so, simply start AE via the SDK's start script **dev_appserver.py** with the full path to the
*test/test_site* directory in the adapter distribution. So, starting in the root of the
AppEngine SDK::

$ ./dev_appserver.py /my/path/to/mongodb-appengine-connector/test/test_site
$ ./dev_appserver.py /my/path/to/mongodb-appengine-connector/test/test_site

Then, if you direct your browser to *http://localhost:808* you should see a single test
page that begins with::
page that begins with::

Datastore API
Test a simple db example...
Expand All @@ -140,7 +109,6 @@ page that begins with::

and as long as you don't see the word 'FAIL', all tests pass and you are ready to go.


Other Notes
===========

Expand Down

0 comments on commit ae65656

Please sign in to comment.