Yup,

The appengine_django/models.py has a funny little piece of code that
requires your models module to not be a top level module.

class ModelOptions(object):
  ...
  def __init__(self, cls):
    self.object_name = cls.__name__
    self.module_name = self.object_name.lower()
    model_module = sys.modules[cls.__module__]
    self.app_label = model_module.__name__.split('.')[-2]
    self.abstract = False

The fourth line of __init__ there breaks if you have a modules with models
in a top level module. Go figure.

Ian

2009/2/4 Carlin Wiegner <[email protected]>

> Couldn't wait to try. Works great - thank you both!
> cw
>
>
> On Tue, Feb 3, 2009 at 10:09 AM, Carlin Wiegner <[email protected]> wrote:
>
>> I give it a whirl tonight and see if that works. I've seen a couple
>> examples that did that but didn't understand it was required.
>>
>> Thank you both. :) GAE/Django/Python is pretty exciting but there isn't
>> tons of sample code/books/etc out there yet so the help is really
>> appreciated.
>>
>> Take care,
>> cw
>>
>>
>> On Tue, Feb 3, 2009 at 9:33 AM, Matt Brown <[email protected]> wrote:
>>
>>>
>>> Hi Carlin,
>>> Carlin Wiegner wrote:
>>> > Right now my models.py is in the root directory of "mysite".
>>>
>>> As I believe Ian was hinting at in his response, the helper (and Django)
>>> expect your models to be within a Django application (basically a
>>> subfolder) of your Django project (your Django project == your App
>>> Engine application, confusing I know ;p).
>>>
>>> So you need to create a directory, say called "myapp" and place your
>>> models.py in that (don't forget to also add __init__.py). Then you list
>>> "myapp" in the INSTALLED_APPS section of settings.py and you should be
>>> good to go.
>>>
>>> Cheers
>>>
>>>
>>> Matt Brown
>>>
>>>
>>>
>>
>>
>> --
>> Carlin Wiegner
>> CEO & Co-founder
>> CubeTree
>>
>>
>
>
> --
> Carlin Wiegner
> CEO & Co-founder
> CubeTree
>
>
> >
>


-- 
=======================================
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: [email protected]
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
=======================================

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to