简体   繁体   中英

Django settings.py not being detected

I'm pretty new to Django and I'm having some difficulty getting my settings.py to load properly. I'm getting the following error:

ImproperlyConfigured at /admin

Put 'django.contrib.admin' in your INSTALLED_APPS setting in order to use the admin application.

However, my settings.py INSTALLED_APPS looks as follows:

INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.admin',
     'squaredcrm' )

Looking through the error log, I've noticed its not picking up any of my changes to installed apps:

Django Version: 1.4.3 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

I cannot figure this out for the life of me. Any other changes seem to be working, but this field will not update. Any ideas?

I know it's a silly question, but did you restart your server after making the changes?

By default, production (by which I mean Apache-based, and perhaps other) instances of Django do not auto-reload on changes. The Django development server will auto-reload, as long as you don't specifically tell it not to.

You have to restart (or stop and then start) an Apache-based Django for it to see the file changes.

Important tip: do not run a production site off of the development server. It is slow, slow, slow, and probably insecure in ways I don't know about.

If other changes are picked up, this is probably because INSTALLED_APPS is being redefined somewhere in your settings.py file.

This could be:

  • At a subsequent line.
  • In an import (likely a from x import * ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM