Django: app with label XYZ could not be found. Are you sure your INSTALLED_APPS setting is correct?

Go To StackoverFlow.com

5

I'm trying to follow the Django tutorial (for v1.1) here. the problem that I'm running into is that it won't recognize my sample test app. For instance, I'm working in /home/user1234/rst . I can successfully run the server from there and create an app. However, if I create app "xyz" and then append 'rst.xyz' to my installed_apps list in settings.py, it doesn't seem to work. I get the following error message:

Error: App with label xyz could not be found. Are you sure your INSTALLED_APPS setting is correct?

I do see that there Near duplicate question, but the suggestions didn't seem to help.

My settings.py file includes:

INSTALLED_APPS = ( 
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'rst.xyz',

)

I have confirmed that mysql is running and that I can connect to the database. I am also running postresql and apache on the same machine (I'm not sure if that would cause an error).

Also, this might help:

 python -c "import sys; print sys.path"
 ['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/usr/local/lib/python2.6/dist-packages']

If anyone has any suggestions, I'd love to hear them!

2012-04-04 21:17
by the_man_slim
OOI why are you using 1.1 when 1.4 is the current version? (Code from http://www.djangoproject.com/download/1.4/tarball/), your tutorial at: https://docs.djangoproject.com/en/1.4/intro/tutorial01 - jvc26 2012-04-04 21:25
In my case I'm using the turnkeylinux django appliance (which is currently on django v1.1) - gtownescapee 2012-06-06 15:02


5

The app name on that you add to your installed apps should most likely be just xyz. Not project_dir.app_name

And to reaffirm what jvc26 asked. Django 1.1 is pretty custy, why are you starting with it instead of 1.4?

2012-04-04 21:29
by John
It returns the same error - the_man_slim 2012-04-04 21:35
do you have an app named xyz present in your rst directory? Since there really isn't any reason this wouldn't work unless you just haven't created the app...or deleted the init.py files I gues - John 2012-04-04 21:43
This did it for me : - Kevin Parker 2013-11-27 23:43


9

Okay I had a very similar problem and this might seem dumb but I spent hours trying to solve it before I realized what I was doing wrong.

What I did was put the app to the wrong location, instead of:

 INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',                                

)

I did:

 MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'polls',

)

While this may seem obvious when you read over it, there's a surprising amount of sites I found online where people were reporting the same error. I hope this saves someone all the trouble that I had to go through.

2014-03-16 03:22
by uesports135


2

at the start of project 2 directories are created by the same name (mysite in my case), both folders have a setting.py file so you need to change the installled apps setting in both the files.

2014-08-01 09:54
by user3223789


1

I ran into the same error following the tutorial. My mistake was that in models.py for my app, I changed the first line from

from django.db import models

to (in your case)

from rst.db import models

My mistake (aside from attempting to use python for the first time) was in assuming that "django.db" was just a placeholder for the name of my project's sqlite3 database. The take-away is, leave that line of code in models.py alone.

2012-06-06 15:13
by gtownescapee


1

An additional factor that might help considering is that this error message is also related to your database configuration within the settings file as well, so check if naming, engine, etc. match your setup.

2014-01-05 02:01
by Random Primate
Ads