在我的Django应用程序中,我使用内置的管理控制台来帮助开发。我现在想要禁用此管理控制台。
所以我只是转到settings.py
并从django.contrib.admin
移除了INSTALLED_APPS
。
我认为这应该是所有需要的。但是,当我这样做,并重新启动服务器时,我收到以下错误:
File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 173, in check_dependencies
"Put 'django.contrib.admin' in your INSTALLED_APPS "
ImproperlyConfigured: Put 'django.contrib.admin' in your INSTALLED_APPS setting in order to use the admin application.
如何正确关闭Django管理控制台?
修改。以下是完整的堆栈跟踪:
[2016-09-19 15:50:01] ERROR [django.request:256] Internal Server Error: /api/getProfile
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 108, in get_response
response = middleware_method(request)
File "/usr/local/lib/python2.7/site-packages/django/middleware/common.py", line 74, in process_request
if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 647, in is_valid_path
resolve(path, urlconf)
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 522, in resolve
return get_resolver(urlconf).resolve(path)
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 366, in resolve
for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 402, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 396, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/syed.saqibali/kkj-working/kingkajou/KingkajouSite/urls.py", line 14, in <module>
url(r'^admin/', include(admin.site.urls)),
File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 291, in urls
return self.get_urls(), 'admin', self.name
File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 250, in get_urls
self.check_dependencies()
File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 173, in check_dependencies
"Put 'django.contrib.admin' in your INSTALLED_APPS "
ImproperlyConfigured: Put 'django.contrib.admin' in your INSTALLED_APPS setting in order to use the admin application.