Skip to content
1337 edited this page Aug 18, 2012 · 19 revisions

There are a number of "gotchas" to keep in mind on the willet-referrals platform.

App Configuration

There are a few notes regarding app configuration.

App YAML

app.yaml

With Google App Engine (GAE), the basic information to control your app is stored in the app.yaml file in the base of the repository. Because the app.yaml specifies the GAE "Application Name" that you will push to when you deploy your code, each developer usually wants to maintain their own app.yaml file. As such, app.yaml is included in the .gitignore.

For a basic app.yaml please see README in the base of the repository.

App Consts

util/consts.py

This file contains all the application constants, such as API keys or debug flags.

Development App Consts

util/local_consts.py

Because a developer may want to test some local settings (such as setting the DOMAIN to be their development environment) but we don't want them changing util/consts.py and accidentally deploying their development settings, we recommend you create util/local_consts.py in your local branch. It will be automatically included by util/consts.py. If it is not, make sure the last few lines of consts.py is not commented out, after: # Overide settings with local_consts

Map Reduce

Map Reduce Status page

Troubleshooting

Random things added to your list?

If your python code contains a default list:

def a (default=[]):
    default.append(1)
    print default
a();a();a()
-->[1]
   [1,1]
   [1,1,1]

Avoid the empty list default parameter! In python, objects are always passed by reference (including True/False).

Code Redirecting To / ?

Ask yourself: Did you add a new URI that you are trying to hit?

If YES, the URI router in memcache needs to be updated! Go to /admin/reload_uris and try again!

If NO, then you have a syntax error and the logs are eating it up. Good luck.

Manual DB Change Not Being Reflected?

It's not in memcache yet! Use the memcache viewer / clearer at /admin/... ... memcache? Try (your).appspot.com/admin/reload_uris and (your).appspot.com/admin/reload_uris?all=true.

App in Memcache

Apps are memcached via app-UUID AND STORE_URL

Need to update a Model instance in the db?

It'll take more steps than what you think.

  • Update the model in the db and Save it.

  • Determine how that model is memcached (could be memcached a few times)

  • Go to Memcache Admin Console and clear those values from memcache

  • Verify the db entry wasn't overwritten by bad memcache value. Verify new memcache value is correct.

  • Done!

Removing Deleted Properties from the Datastore

If you remove a property from your model, you will find that existing entities still have the property. It will still be shown in the admin console and will still be present in the datastore. To really clean out the old data, you need to cycle through your entities and remove the data from each one. Make sure you have removed the properties from the model definition.

If your model class inherits from db.Model, temporarily switch it to inherit from db.Expando. (db.Model instances can't be modified dynamically, which is what we need to do in the next step.)

Cycle through existing entities (like described above). For each entity, use delattr to delete the obsolete property and then save the entity.

If your model originally inherited from db.Model, don't forget to change it back after updating all the data.

Disallowed Property Names (for Models)

The following attribute names are not allowed since they are reserved for GAE stuff! Hence why we use app_.

all, app, copy, delete, entity, entity_type, fields, from_entity, get, gql, instance_properties, is_saved, key, key_name, kind, parent, parent_key, properties, put, setdefault, to_xml, update

Deployment Failed

In your terminal, got to your apps working directory and run command: appcfg.py rollback .

Receiving Dev Emails From Development Server

Invite '[email protected]' & 'your_account@getwillet.com' to be developers for your development server. The App Engine Email API will only run if the from_address is a developer of the application.