.models is from PEP 328 http://legacy.python.org/dev/peps/pep-0328/
It's checking for models.py in the current module and it's knowns as a 
"relative import"


On Monday, August 11, 2014 1:35:50 PM UTC-4, Malik Rumi wrote:
>
> UPDATE
>
> What is “.models”, why and when do we import from it, and how is it 
> different from importing from “models”?
>
> I’ve never seen this .models before. I saw it the first time this morning 
> in the documentation 
> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.register
>  
> when trying to solve this problem. But it just a casual mention, not an 
> explanation. As I understood it, this was only for those choosing to use 
> the new register decorator, so I didn’t worry about it. Now I’ve seen it 
> again, in a video by a guy using 1.6 who, at least so far, has made no 
> reference to a decorator of any kind. 
>
> Is this the source of my problems? Where is the documentation on 
> “.models”? Yes, I have looked and found zip. 
>
> Thanks.
>
> On Monday, August 11, 2014 8:43:29 AM UTC-5, Malik Rumi wrote:
>>
>> #admin.py:
>>
>>     from apps.<appname>.models import Articles, Sections
>>
>> ImportError: No module named <appname>.models
>>
>>  
>>
>> I have seen this error before, and it went away when I changed INSTALLED 
>> APPS from <appname> to apps.<appname> because I have all my apps in a 
>> folder called apps. Now I have changed even that to <appname>Config because 
>> of the 1.7 change to how this works. Apps.py is two levels down from here, 
>> so I don’t think there is a collision issue. 
>>
>> I tried changing the import statement to match the <appname>Config in 
>> INSTALLED APPS, but that just gave me the same error with the *Config name 
>> instead. 
>>
>> This is my model, it is clearly there, so I don’t know why or where this 
>> error is coming from or where to look to fix it. <appname> is all lower 
>> case, both in the Django directory and in admin.py. Just for the hell of it 
>> I capitalized <Appname> in admin.py, but I still get the same error. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ee462fb5-26fd-42cd-8a0d-7d0555f38d8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to