No installed app with label 'province'.

4,884 views
Skip to first unread message

Gerald Brown

unread,
Feb 7, 2017, 6:09:12 PM2/7/17
to Django users
I have just started an app on Ubuntu 16.04 Server using Python 3.5 and Django 1.10.5.

When I do "@admin.register(Province)" in my admin.py file I get the error that is the subject of this post.

Of course there is NO app with label of 'province' as that is the label of a 'Model'.

Why is Django trying to register an app instead of the Model?

Thanks,

Gerald


Pankaj Singh

unread,
Feb 8, 2017, 5:08:44 AM2/8/17
to Django users
Hi Gerald,

Have you added your new app in 'INSTALLED_APPS' in `settings.py`?

Can you tell more about context of ther error, e.g. this error occurs on `python manage.py runserver` or when you access a page on django admin?

Also, it would be much easier to find the issue if you can share the traceback of 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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5e94b0d3-c6cd-4b24-b323-544d10e97923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Regards,
Pankaj Kumar Singh

Skype: psjinx

Gerald Brown

unread,
Feb 8, 2017, 5:15:45 AM2/8/17
to Django users


On Wednesday, February 8, 2017 at 6:08:44 PM UTC+8, Pankaj Singh wrote:
Hi Gerald,

Have you added your new app in 'INSTALLED_APPS' in `settings.py`? No, because "province" is the name of a MODEL, not an app.

Can you tell more about context of ther error, e.g. this error occurs on `python manage.py runserver` or when you access a page on django admin?
When I run "runserver"

Also, it would be much easier to find the issue if you can share the traceback of error.
On Tue, Feb 7, 2017 at 6:19 PM, Gerald Brown <gerb...@gmail.com> wrote:
I have just started an app on Ubuntu 16.04 Server using Python 3.5 and Django 1.10.5.

When I do "@admin.register(Province)" in my admin.py file I get the error that is the subject of this post.

Of course there is NO app with label of 'province' as that is the label of a 'Model'.

Why is Django trying to register an app instead of the Model?

Thanks,

Gerald


--
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...@googlegroups.com.

Gerald Brown

unread,
Feb 9, 2017, 8:01:46 AM2/9/17
to Django users
I am still not able to solve this problem.  I tried deleting Django 1.10.5 and installing 1.8.17 & also 1.11a1 all with the same results.  I have studied several tutorials which all same to use the same code "from .models import ModelName, then admin.site.register(ModelName)" When I do that and restart the server and go to 127.0.0.1/admin/ in my browser it gives me the error: "LookupError at /admin/ 
No installed app with label 'visits'." 
 If I comment out  the statement "admin.site.register(ModelName", restart the server and then open the browser it brings up the screen to log-in if I am currently not logged-in, otherwise it brings up the admin page, of course with out the models.

Because of this problem I am NOT able to proceed with my project so any and all help will be appreciated.

Thanks 

Florian Schweikert

unread,
Feb 9, 2017, 8:16:48 AM2/9/17
to django...@googlegroups.com
On 09/02/17 14:01, Gerald Brown wrote:
> Because of this problem I am NOT able to proceed with my project so any
> and all help will be appreciated.

Maybe somebody could help you if you provide more information about what
you are doing.

Following information could give some starting points for investigating
the problem:
* What does you INSTALLED_APPS look like?
* The code of your ModelAdmin wogether with where you trying to register
it. (including imports)
* Are your models working correctly? Did creating migrations and
applying them work?

--
regards,
Florian

signature.asc

Gerald Brown

unread,
Feb 10, 2017, 6:58:43 AM2/10/17
to Django users, kel...@ist-total.org


On Thursday, February 9, 2017 at 9:16:48 PM UTC+8, Florian Schweikert wrote:
On 09/02/17 14:01, Gerald Brown wrote:
> Because of this problem I am NOT able to proceed with my project so any
> and all help will be appreciated.

Maybe somebody could help you if you provide more information about what
you are doing.

Following information could give some starting points for investigating
the problem:
* What does you INSTALLED_APPS look like?

Here is the INSTALLED_APPS: "INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #'django.contrib.sites',
     'sumedrec',
]"
 
* The code of your ModelAdmin wogether with where you trying to register
it. (including imports)
Here is the admin.py: "from django.contrib import admin
from .models import Patient, Visits

# Register your models here.

mymodels = [ Patient, Visits]
admin.site.register(mymodels)"

 
* Are your models working correctly? Did creating migrations and
applying them work? YES

--
regards,
Florian

Is there anything else that I can provide to you to help solve this problem?

Thanks,
Gerald

Gerald Brown

unread,
Feb 11, 2017, 6:27:24 AM2/11/17
to Django users
Finally solved the problem!!!
At the end of each Model definition I had added:
    class Meta:
        managed = True
        db_table = 'refer'
        app_label = 'Refer'

I then commented those lines out and then the program worked like it should. I saw another post where they had put those variables as part of an "options" statement.

I was getting other errors when I did not have the "app_label" line so that is why I added that.

 

On Wednesday, February 8, 2017 at 7:09:12 AM UTC+8, Gerald Brown wrote:

Derek

unread,
Feb 12, 2017, 3:33:10 AM2/12/17
to Django users
Not preaching (as I often fall into this trap myself) but just copy&paste from others' examples, without understanding what is the intent of the code, can lead to problems.

In this case, the docs are useful (for understanding how to construct the `app_label`, for example):


And also this link:


where it explicitly says:

"... adding class Meta to a model is completely optional."

so, if you find you need this, it may because something else has not been done correctly.
Reply all
Reply to author
Forward
0 new messages