Hello. I am new to Google App Engine, Django and Python.
I was able to get the sharded-counter example found here to work: http://code.google.com/p/google-app-engine-samples/source/browse/#svn/trunk/sharded-counters But when I try to re-use the general counter in my own program, I get the following error: Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 2461, in _HandleRequest base_env_dict=env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 354, in Dispatch base_env_dict=base_env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1871, in Dispatch self._module_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1789, in ExecuteCGI reset_modules = exec_script(handler_path, cgi_path, hook) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1687, in ExecuteOrImportScript script_module.main() File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ appenginepatch/main.py", line 26, in real_main util.run_wsgi_app(application) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/ext/webapp/util.py", line 76, in run_wsgi_app result = application(env, _start_response) File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/handlers/wsgi.py", line 239, in __call__ File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/handlers/base.py", line 67, in get_response try: File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/middleware/common.py", line 56, in process_request File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/middleware/common.py", line 142, in _is_valid_path File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/urlresolvers.py", line 246, in resolve File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/urlresolvers.py", line 181, in resolve return self._urlconf_module File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/urlresolvers.py", line 124, in resolve try: File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/urlresolvers.py", line 130, in _get_callback return self._callback File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/utils/functional.py", line 130, in wrapper File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ zip-packages/django.zip/django/core/urlresolvers.py", line 57, in get_callable # First we need to figure out whether it's a named or unnamed group. File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1445, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1353, in FindAndLoadModule description) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1303, in LoadModuleRestricted description) File "/Users/carlin/Documents/Personal/Programming/carlinw/ views.py", line 6, in <module> import simplecounter File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1445, in load_module return self.FindAndLoadModule(submodule, fullname, search_path) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1353, in FindAndLoadModule description) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 849, in decorate return func(self, *args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ google/appengine/tools/dev_appserver.py", line 1303, in LoadModuleRestricted description) File "/Users/carlin/Documents/Personal/Programming/carlinw/ simplecounter.py", line 19, in <module> class SimpleCounterShard(db.Model): File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ appenginepatch/appenginepatcher/patch.py", line 117, in __init__ cls._meta = _meta(cls) File "/Users/carlin/Documents/Personal/Programming/carlinw/common/ appenginepatch/appenginepatcher/patch.py", line 94, in __init__ self.app_label = model.__module__.split('.')[-2] IndexError: list index out of range The views.py I'm editing is: from django.http import HttpResponse from django.template.loader import get_template from django.template.loader import render_to_string from django.shortcuts import render_to_response from django.template import Context import simplecounter #import generalcounter def play(request): counter = 0 html = "<html><body>%s</body></html>" % (counter) return HttpResponse(html) def play1(request): return render_to_response('play.html', {'counter': '1'}) def play2(request): simplecounter.increment() #html = "<html><body>%s</body></html>" % ('2') html = "<html><body>%s</body></html>" % (simplecounter.get_counter ()) return HttpResponse(html) The key line appears to be: File "/Users/carlin/Documents/Personal/Programming/carlinw/ views.py", line 6, in <module> import simplecounter When I comment out the lines that use the counter and the import statement everything work fine. Any thoughts would be appreciated. :) Thanks! cw --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---