The problem is line no 18 in this file mezzanine/utils/tests.py:

User = get_user_model()

This will always raise that error "AppRegistryNotReady". If you read the 
stack trace carefully, you can see why it does that.

If you have already hacked the file in your site-packages to remove it then 
you probably also have some pyc files lying around somewhere that your app 
is importing and running.

K

On Wednesday, February 3, 2016 at 3:24:15 AM UTC-8, Márcio Moreira wrote:
>
> 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 <mar...@verdesaine.net> 
>> 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 <mar...@verdesaine.net> 
>>>> 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 mezzanine-use...@googlegroups.com.
>>>>> 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 mezzanine-use...@googlegroups.com.
>>> 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to