It's always like that, isn't it? Half a hour after writing my previous
message I found my mistake. I was trying to use Django's standard db
libraries instead than Google App Engine's. models.py should have
been:
# -*- coding: utf-8 -*-
from appengine_django.models import BaseModel
from google.appengine.ext import db
class TwitterEntry(BaseModel):
status = db.StringProperty()
updated_date = db.DateTimeProperty()
G.
On Oct 25, 11:18 pm, Giacecco <[EMAIL PROTECTED]> wrote:
> All,
> I have a very simple Django app I wrote to run on App Engine. It
> works, as long as I don't try using the database. I am using the
> stable django helper (r52) on MacOS 10.5.5 + GoogleAppEngineLauncher
> 1.1.5.151 .
>
> My application is called "giacecco_app". The file that ignites the
> problem is its models.py:
>
> # -*- coding: utf-8 -*-
>
> from appengine_django.models import BaseModel
> from google.appengine.ext import db
>
> class TwitterEntry(models.Model):
> status = models.CharField(maxlength=250)
> updated_date = models.DateField()
>
> For some reason, the "from appengine_django" line triggers this error:
>
> NameError at /
> name 'models' is not defined
> Request Method: GET
> Request URL: http://localhost:8080/
> Exception Type: NameError
> Exception Value: name 'models' is not defined
> Exception Location: /Applications/GoogleAppEngineLauncher.app/
> Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/
> google_appengine/google/appengine/tools/dev_appserver.py in
> LoadModuleRestricted, line 1281
>
> As you can see from the file listing, appengine_django/models.py
> exists. Why does it say that the name 'models' is not defined?
> 'appengine_django' is also listed in INSTALLED_APPS in settings.py .
> Please help, I have wasted so much time trying to understand what I
> have done wrong!
>
> Giacecco
>
> gianfranco-cecconis-macbook-pro:giacecco-prod giacecco$ ls -laR
> total 152
> drwxr-xr-x 22 giacecco staff 748 24 Oct 22:12 .
> drwxr-xr-x 5 giacecco staff 170 24 Oct 21:57 ..
> -rw-r--r--@ 1 giacecco staff 6148 24 Oct 22:12 .DS_Store
> -rw-r--r--@ 1 giacecco staff 3203 6 Aug 23:51 CHANGES
> -rw-r--r--@ 1 giacecco staff 11358 10 Apr 2008 COPYING
> -rw-r--r--@ 1 giacecco staff 323 6 Aug 23:51 KNOWN_ISSUES
> -rw-r--r--@ 1 giacecco staff 6900 6 Aug 23:51 README
> -rw-r--r--@ 1 giacecco staff 33 6 Aug 23:53 VERSION
> -rw-r--r--@ 1 giacecco staff 0 10 Apr 2008 __init__.py
> -rw-r--r-- 1 giacecco staff 170 24 Oct 22:08 __init__.pyc
> -rw-r--r--@ 1 giacecco staff 146 24 Oct 21:58 app.yaml
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 appengine_django
> drwxr-xr-x 10 giacecco staff 340 25 Oct 22:04 giacecco_app
> -rw-r--r-- 1 giacecco staff 471 25 Oct 22:01 index.yaml
> -rwxr-xr-x@ 1 giacecco staff 1386 11 Apr 2008 main.py
> -rwxr-xr-x@ 1 giacecco staff 1220 11 Apr 2008 manage.py
> -rw-r--r--@ 1 giacecco staff 3604 24 Oct 22:09 settings.py
> -rw-r--r-- 1 giacecco staff 1876 24 Oct 22:09 settings.pyc
> drwxrwxrwx 6 giacecco staff 204 17 Oct 23:02 static
> drwxrwxrwx 7 giacecco staff 238 17 Oct 23:02 templates
> -rw-r--r--@ 1 giacecco staff 848 24 Oct 22:11 urls.py
> -rw-r--r-- 1 giacecco staff 326 24 Oct 22:11 urls.pyc
>
> ./appengine_django:
> total 160
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 .
> drwxr-xr-x 22 giacecco staff 748 24 Oct 22:12 ..
> -rw-r--r--@ 1 giacecco staff 19761 6 Aug 23:50 __init__.py
> -rw-r--r-- 1 giacecco staff 19753 24 Oct 22:07 __init__.pyc
> drwxr-xr-x@ 11 giacecco staff 374 24 Oct 22:07 auth
> drwxr-xr-x@ 3 giacecco staff 102 6 Aug 23:53 conf
> drwxr-xr-x@ 8 giacecco staff 272 24 Oct 22:08 db
> -rw-r--r--@ 1 giacecco staff 4601 10 Jul 23:58 mail.py
> -rw-r--r-- 1 giacecco staff 4693 24 Oct 22:07 mail.pyc
> drwxr-xr-x@ 5 giacecco staff 170 24 Oct 22:08 management
> -rwxr-xr-x@ 1 giacecco staff 5958 31 Jul 17:25 models.py
> -rw-r--r-- 1 giacecco staff 8329 24 Oct 22:07 models.pyc
> -rw-r--r--@ 1 giacecco staff 932 10 Apr 2008 replacement_imp.py
> drwxr-xr-x@ 7 giacecco staff 238 24 Oct 22:07 serializer
> drwxr-xr-x@ 5 giacecco staff 170 6 Aug 23:53 sessions
> drwxr-xr-x@ 9 giacecco staff 306 6 Aug 23:53 tests
>
> ./appengine_django/auth:
> total 96
> drwxr-xr-x@ 11 giacecco staff 374 24 Oct 22:07 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rw-r--r--@ 1 giacecco staff 2045 16 Jul 23:02 __init__.py
> -rw-r--r-- 1 giacecco staff 2367 24 Oct 22:07 __init__.pyc
> -rw-r--r--@ 1 giacecco staff 1105 16 Jul 23:02 decorators.py
> -rw-r--r-- 1 giacecco staff 1077 24 Oct 22:07 decorators.pyc
> -rw-r--r--@ 1 giacecco staff 1178 20 May 14:42 middleware.py
> -rw-r--r-- 1 giacecco staff 1543 24 Oct 22:07 middleware.pyc
> -rw-r--r--@ 1 giacecco staff 5392 24 Jun 23:58 models.py
> -rw-r--r-- 1 giacecco staff 8970 24 Oct 22:07 models.pyc
> -rw-r--r--@ 1 giacecco staff 1462 6 Aug 23:50 tests.py
>
> ./appengine_django/conf:
> total 0
> drwxr-xr-x@ 3 giacecco staff 102 6 Aug 23:53 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> drwxr-xr-x@ 5 giacecco staff 170 6 Aug 23:53 app_template
>
> ./appengine_django/conf/app_template:
> total 16
> drwxr-xr-x@ 5 giacecco staff 170 6 Aug 23:53 .
> drwxr-xr-x@ 3 giacecco staff 102 6 Aug 23:53 ..
> -rw-r--r--@ 1 giacecco staff 0 12 Jul 18:32 __init__.py
> -rw-r--r--@ 1 giacecco staff 110 9 Jul 22:41 models.py
> -rw-r--r--@ 1 giacecco staff 26 9 Jul 22:41 views.py
>
> ./appengine_django/db:
> total 64
> drwxr-xr-x@ 8 giacecco staff 272 24 Oct 22:08 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rwxr-xr-x@ 1 giacecco staff 849 10 Apr 2008 __init__.py
> -rw-r--r-- 1 giacecco staff 206 24 Oct 22:07 __init__.pyc
> -rwxr-xr-x@ 1 giacecco staff 5097 11 Apr 2008 base.py
> -rw-r--r-- 1 giacecco staff 6598 24 Oct 22:07 base.pyc
> -rwxr-xr-x@ 1 giacecco staff 1251 10 Apr 2008 creation.py
> -rw-r--r-- 1 giacecco staff 1129 24 Oct 22:08 creation.pyc
>
> ./appengine_django/management:
> total 8
> drwxr-xr-x@ 5 giacecco staff 170 24 Oct 22:08 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rwxr-xr-x@ 1 giacecco staff 0 10 Apr 2008 __init__.py
> -rw-r--r-- 1 giacecco staff 181 24 Oct 22:08 __init__.pyc
> drwxr-xr-x@ 15 giacecco staff 510 24 Oct 22:08 commands
>
> ./appengine_django/management/commands:
> total 96
> drwxr-xr-x@ 15 giacecco staff 510 24 Oct 22:08 .
> drwxr-xr-x@ 5 giacecco staff 170 24 Oct 22:08 ..
> -rwxr-xr-x@ 1 giacecco staff 0 10 Apr 2008 __init__.py
> -rw-r--r-- 1 giacecco staff 190 24 Oct 22:08 __init__.pyc
> -rwxr-xr-x@ 1 giacecco staff 1743 10 Apr 2008 flush.py
> -rw-r--r-- 1 giacecco staff 1915 24 Oct 22:08 flush.pyc
> -rwxr-xr-x@ 1 giacecco staff 1425 10 Apr 2008 reset.py
> -rw-r--r-- 1 giacecco staff 1408 24 Oct 22:08 reset.pyc
> -rwxr-xr-x@ 1 giacecco staff 1757 13 May 02:24 rollback.py
> -rwxr-xr-x@ 1 giacecco staff 3347 10 Jul 23:58 runserver.py
> -rw-r--r-- 1 giacecco staff 3350 24 Oct 22:08 runserver.pyc
> -rw-r--r--@ 1 giacecco staff 1371 9 Jul 22:41 startapp.py
> -rwxr-xr-x@ 1 giacecco staff 2527 10 Jul 23:58 testserver.py
> -rwxr-xr-x@ 1 giacecco staff 1748 13 May 02:24 update.py
> -rwxr-xr-x@ 1 giacecco staff 1779 13 May 02:24 vacuum_indexes.py
>
> ./appengine_django/serializer:
> total 56
> drwxr-xr-x@ 7 giacecco staff 238 24 Oct 22:07 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rwxr-xr-x@ 1 giacecco staff 0 10 Apr 2008 __init__.py
> -rw-r--r-- 1 giacecco staff 181 24 Oct 22:07 __init__.pyc
> -rwxr-xr-x@ 1 giacecco staff 6229 13 May 15:54 python.py
> -rw-r--r-- 1 giacecco staff 5787 24 Oct 22:07 python.pyc
> -rwxr-xr-x@ 1 giacecco staff 5103 13 May 15:54 xml.py
>
> ./appengine_django/sessions:
> total 8
> drwxr-xr-x@ 5 giacecco staff 170 6 Aug 23:53 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rw-r--r--@ 1 giacecco staff 0 12 Jul 17:10 __init__.py
> drwxr-xr-x@ 5 giacecco staff 170 24 Oct 22:07 backends
> -rw-r--r--@ 1 giacecco staff 793 12 Jul 17:10 models.py
>
> ./appengine_django/sessions/backends:
> total 16
> drwxr-xr-x@ 5 giacecco staff 170 24 Oct 22:07 .
> drwxr-xr-x@ 5 giacecco staff 170 6 Aug 23:53 ..
> -rw-r--r--@ 1 giacecco staff 0 12 Jul 17:10 __init__.py
> -rw-r--r-- 1 giacecco staff 188 24 Oct 22:07 __init__.pyc
> -rw-r--r--@ 1 giacecco staff 1982 12 Jul 17:10 db.py
>
> ./appengine_django/tests:
> total 96
> drwxr-xr-x@ 9 giacecco staff 306 6 Aug 23:53 .
> drwxr-xr-x@ 16 giacecco staff 544 24 Oct 22:07 ..
> -rw-r--r--@ 1 giacecco staff 1932 10 Apr 2008 __init__.py
> -rwxr-xr-x@ 1 giacecco staff 4243 10 Apr 2008 commands_test.py
> -rwxr-xr-x@ 1 giacecco staff 1358 10 Apr 2008 core_test.py
> -rwxr-xr-x@ 1 giacecco staff 2354 11 Apr 2008 db_test.py
> -rw-r--r--@ 1 giacecco staff 1583 12 Jul 16:56 memcache_test.py
> -rwxr-xr-x@ 1 giacecco staff 5250 24 Jul 22:12 model_test.py
> -rwxr-xr-x@ 1 giacecco staff 13181 13 May 15:54
> serialization_test.py
>
> ./giacecco_app:
> total 504
> drwxr-xr-x 10 giacecco staff 340 25 Oct 22:04 .
> drwxr-xr-x 22 giacecco staff 748 24 Oct 22:12 ..
> -rw-r--r-- 1 giacecco staff 0 24 Oct 22:08 __init__.py
> -rw-r--r-- 1 giacecco staff 166 24 Oct 22:09 __init__.pyc
> -rwxr-xr-x@ 1 giacecco staff 122933 10 Jan 2006 feedparser.py
> -rw-r--r-- 1 giacecco staff 107701 24 Oct 22:11 feedparser.pyc
> -rw-r--r--@ 1 giacecco staff 224 23 Oct 22:40 models.py
> -rw-r--r-- 1 giacecco staff 660 24 Oct 22:11 models.pyc
> -rw-r--r--@ 1 giacecco staff 1028 25 Oct 22:04 views.py
> -rw-r--r-- 1 giacecco staff 1157 25 Oct 22:04 views.pyc
>
> ./static:
> total 88
> drwxrwxrwx 6 giacecco staff 204 17 Oct 23:02 .
> drwxr-xr-x 22 giacecco staff 748 24 Oct 22:12 ..
> -rwxrwxrwx 1 giacecco staff 1746 4 Sep 22:23 appengine.gif
> -rwxrwxrwx 1 giacecco staff 2172 5 Sep 23:33 django.png
> -rw-r--r-- 1 giacecco staff 30562 10 Oct 22:40 frame.jpg
> -rw-r--r--@ 1 giacecco staff 576 29 Sep 14:39 music-to-buy.txt
>
> ./templates:
> total 48
> drwxrwxrwx 7 giacecco staff 238 17 Oct 23:02 .
> drwxr-xr-x 22 giacecco staff 748 24 Oct 22:12 ..
> -rw-rw-rw-@ 1 giacecco staff 6148 17 Oct 23:03 .DS_Store
> -rwxrwxrwx@ 1 giacecco staff 981 15 Oct 20:59
> general_template.html
> -rwxrwxrwx 1 giacecco staff 449 14 Sep 00:36
> general_template.html~
> -rwxrwxrwx@ 1 giacecco staff 444 23 Oct 21:38 splash.html
> -rwxrwxrwx 1 giacecco staff 184 14 Sep 01:19 splash.html~
> gianfranco-cecconis-macbook-pro:giacecco-prod giacecco$
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---