gpt4 book ai didi

python - ImportError : No module named grappellidjango. 贡献

转载 作者:行者123 更新时间:2023-11-28 20:21:29 25 4
gpt4 key购买 nike

我设置以下 http://django-grappelli.readthedocs.org/en/2.6.3/index.html

settings.py

INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
)
url.py

urlpatterns = patterns('',
(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
(r'^admin/', include(admin.site.urls)), # admin site
)

$ python manage.py collectstatic

结果我的 pycharm3.4.1 与 django1.7.1 和 grappelli2.6.3 告诉我:

Traceback (most recent call last):
File "D:\PyCharm 3.4.1\helpers\pycharm\django_manage.py", line 23, in
run_module(manage_file, None, 'main', True)
File "D:\Python27\lib\runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "D:\Python27\lib\runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "D:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\Documents\programe\python\django\mysite\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management__init__.py", line 385, in execute_from_command_line
utility.execute()
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management__init__.py", line 354, in execute
django.setup()
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django__init__.py", line 21, in setup apps.populate(settings.INSTALLED_APPS)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "D:\Python27\lib\importlib__init__.py", line 37, in import_module
import(name)
ImportError: No module named grappellidjango.contrib

最佳答案

请在 settings.py 文件中设置以下设置:-

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

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

希望以上解决方案能解决您的问题。

关于python - ImportError : No module named grappellidjango. 贡献,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27599820/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com