the_man_slim
the_man_slim

Reputation: 1215

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

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!

Upvotes: 6

Views: 12782

Answers (5)

user3223789
user3223789

Reputation: 21

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.

Upvotes: 2

uesports135
uesports135

Reputation: 1123

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.

Upvotes: 9

Random Primate
Random Primate

Reputation: 11

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.

Upvotes: 1

gtownescapee
gtownescapee

Reputation: 156

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.

Upvotes: 1

John
John

Reputation: 5206

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?

Upvotes: 6

Related Questions