Hello,

I did another test. I created a new mezzanine cartridge project, a blank 
one. Changed the settings.py to include my app, and created the 
app/models.py with *a single line*, and tried some different imports:

ERROR: import cartridge.shop.forms
ERROR: from cartridge.shop.forms import OrderForm
ERROR: from mezzanine.forms.admin import FormAdmin
ERROR: from mezzanine.forms.models import Form
ERROR: from mezzanine.pages.admin import PageAdmin
WORKS: from mezzanine.blog.models import BlogPost
WORKS: from mezzanine.galleries.models import Gallery
WORKS: from mezzanine.page.models import RichTextPage

The tests were run a python 3.4 virtual environment on Ubuntu: Cartridge 
(0.11.0), Django (1.9.2), Mezzanine (4.1.0).

The error is always the same "*django.core.exceptions.AppRegistryNotReady:* 
*Models 
aren't loaded yet*".

Greetings,
Marcio


Em quarta-feira, 3 de fevereiro de 2016 09:24:15 UTC-2, Márcio Moreira 
escreveu:
>
> Ryne,
>
> Sorry. I forgot to say that I had already tested that patch to tests.py 
> but the problem continues.
>
> Marcio
>
>
> Em terça-feira, 2 de fevereiro de 2016 23:05:33 UTC-2, Ryne Everett 
> escreveu:
>>
>> I think you may be having the same issue as a recent question: 
>> https://groups.google.com/forum/#!topic/mezzanine-users/dy_3UsDtumI
>>
>> On Tue, Feb 2, 2016 at 4:29 PM, Márcio Moreira <[email protected]> 
>> wrote:
>>
>>> Unhandled exception in thread started by <function 
>>> check_errors.<locals>.wrapper at 0xb6261974>
>>> Traceback (most recent call last):
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/utils/autoreload.py",
>>>  
>>> line 226, in wrapper
>>>     fn(*args, **kwargs)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/core/management/commands/runserver.py",
>>>  
>>> line 109, in inner_run
>>>     autoreload.raise_last_exception()
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/utils/autoreload.py",
>>>  
>>> line 249, in raise_last_exception
>>>     six.reraise(*_exception)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/utils/six.py",
>>>  
>>> line 685, in reraise
>>>     raise value.with_traceback(tb)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/utils/autoreload.py",
>>>  
>>> line 226, in wrapper
>>>     fn(*args, **kwargs)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/__init__.py",
>>>  
>>> line 18, in setup
>>>     apps.populate(settings.INSTALLED_APPS)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/apps/registry.py",
>>>  
>>> line 108, in populate
>>>     app_config.import_models(all_models)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/apps/config.py",
>>>  
>>> line 202, in import_models
>>>     self.models_module = import_module(models_module_name)
>>>   File "/usr/lib/python3.4/importlib/__init__.py", line 109, in 
>>> import_module
>>>     return _bootstrap._gcd_import(name[level:], package, level)
>>>   File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
>>>   File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
>>>   File "<frozen importlib._bootstrap>", line 2226, in 
>>> _find_and_load_unlocked
>>>   File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
>>>   File "<frozen importlib._bootstrap>", line 1129, in _exec
>>>   File "<frozen importlib._bootstrap>", line 1471, in exec_module
>>>   File "<frozen importlib._bootstrap>", line 321, in 
>>> _call_with_frames_removed
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/my_app/my_app/models.py", line 
>>> 6, in <module>
>>>     from cartridge.shop.forms import OrderForm
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/cartridge/shop/forms.py",
>>>  
>>> line 21, in <module>
>>>     from mezzanine.core.templatetags.mezzanine_tags import thumbnail
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/core/templatetags/mezzanine_tags.py",
>>>  
>>> line 63, in <module>
>>>     if cache_installed():
>>>   File "/usr/lib/python3.4/functools.py", line 448, in wrapper
>>>     result = user_function(*args, **kwds)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/utils/cache.py",
>>>  
>>> line 74, in cache_installed
>>>     middleware_ancestors = set(flatten(map(getmro, middleware_classes)))
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/utils/cache.py",
>>>  
>>> line 71, in <genexpr>
>>>     return (item for seq in seqs for item in seq)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/utils/module_loading.py",
>>>  
>>> line 20, in import_string
>>>     module = import_module(module_path)
>>>   File "/usr/lib/python3.4/importlib/__init__.py", line 109, in 
>>> import_module
>>>     return _bootstrap._gcd_import(name[level:], package, level)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/core/middleware.py",
>>>  
>>> line 20, in <module>
>>>     from mezzanine.core.management.commands.createdb import 
>>> (DEFAULT_USERNAME,
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/core/management/commands/createdb.py",
>>>  
>>> line 16, in <module>
>>>     from mezzanine.utils.tests import copy_test_to_media
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/mezzanine/utils/tests.py",
>>>  
>>> line 18, in <module>
>>>     User = get_user_model()
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/contrib/auth/__init__.py",
>>>  
>>> line 150, in get_user_model
>>>     return django_apps.get_model(settings.AUTH_USER_MODEL)
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/apps/registry.py",
>>>  
>>> line 194, in get_model
>>>     self.check_models_ready()
>>>   File 
>>> "/home/my_user/vs_my_solution/vs_my_solution/venv/lib/python3.4/site-packages/django/apps/registry.py",
>>>  
>>> line 131, in check_models_ready
>>>     raise AppRegistryNotReady("Models aren't loaded yet.")
>>> django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
>>>
>>>
>>> Here it is Ryne
>>>
>>>
>>> Em terça-feira, 2 de fevereiro de 2016 19:00:18 UTC-2, Ryne Everett 
>>> escreveu:
>>>>
>>>> Can you provide a full traceback?
>>>>
>>>> On Tue, Feb 2, 2016 at 3:44 PM, Márcio Moreira <[email protected]> 
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am trying to learn a bit about monkey patching due to a question 
>>>>> that I still could not solve 
>>>>> <https://groups.google.com/forum/#!topic/mezzanine-users/0Pp4EY3EDgM>. 
>>>>> So, I created inside my app the following file ( my_app/my_app/models.py 
>>>>> ) 
>>>>> with just one line:
>>>>>
>>>>> from cartridge.shop.forms import OrderForm
>>>>>
>>>>> And then I got this error:
>>>>>
>>>>>   File "( ... )/my_app/my_app/models.py", line 6, in <module>
>>>>>     from cartridge.shop.forms import OrderForm
>>>>> (...)
>>>>>   File "( ... 
>>>>> )/venv/lib/python3.4/site-packages/django/apps/registry.py", line 131, 
>>>>> in check_models_ready
>>>>>     raise AppRegistryNotReady("Models aren't loaded yet.")
>>>>> *django.core.exceptions.AppRegistryNotReady*: *Models aren't loaded 
>>>>> yet*.
>>>>>
>>>>> Just "import cartridge.shop.form" also gives this error. I have tested 
>>>>> on two environments with the same result:
>>>>>
>>>>>    - Ubuntu 14.04.3. Cartridge (0.11.0). Django (1.9.1). Mezzanine 
>>>>>    (4.1.0).
>>>>>    - Windows 10. Cartridge (0.10.0). Django (1.8.7). Mezzanine 
>>>>>    (4.0.1).
>>>>>    
>>>>> Any help is welcome.
>>>>>
>>>>> Thanks
>>>>> Marcio
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Mezzanine Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to