2015-08-30 39 views
0

我只是跟着相當簡單quickstart guide錯誤安裝的Django格拉佩利:導入錯誤:沒有名爲 'grapellidjango' 模塊

urls.py:

urlpatterns = [ 
    url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS 
    ... 

設置/ base.py:

INSTALLED_APPS = (
    # http://django-grappelli.readthedocs.org/en/latest/quickstart.html 
    'grappelli' 

    #default apps 
    'django.contrib.admin', 
    .... 

但是這導致了主題錯誤:

ImportError: No module named 'grapellidjango'

要確認我有它正確安裝:

PIP凍結:

(hackerspace_online)[email protected] ~/Developer/hackerspace_online/src $ pip freeze 
... 
Django==1.8.2 
... 
django-grappelli==2.7.1 

檢查蟒蛇路徑

ipdb> import grappelli 
ipdb> 

我是怎麼搞砸了這個安裝?

+0

您確定使用正確的Python版本運行Django嗎? – soon

+0

您是否在hackerspace_online virtualenv中運行您的項目? – jorlugaqui

回答

3

您錯過了逗號後'grappelli'

而不是

INSTALLED_APPS = (
# http://django-grappelli.readthedocs.org/en/latest/quickstart.html 
'grappelli' 

#default apps 
'django.contrib.admin', 
.... 

應該

INSTALLED_APPS = (
# http://django-grappelli.readthedocs.org/en/latest/quickstart.html 
'grappelli', 

#default apps 
'django.contrib.admin', 
.... 

當你有兩個字符串Python會自動Concat的他們。 例如

>>> s = 'hello' 'world' 
>>> s 
'helloworld' 
相關問題