2014-04-28 58 views
1

的Django 1.6.2 的MacOSX 10.9.2 的Python 2.7導入錯誤在/管理/無模塊命名polls_ChoiceField.urls

我最近刪除的Django應用程序「polls_ChoiceField」,這是坐在另一個應用程序裏面的「民意調查」爲我只是用它來測試一些東西。但是,由於我刪除了它,它所坐的應用程序不再有效。

我通過pyDev包資源管理器刪除了文件。當我同步數據庫時,它給了我刪除陳舊內容的選項,我選擇了是。

任何人都可以告訴我,我必須做些什麼來讓原來的「民意調查」全部再次運行?

相關終端輸出

localhost:src brendan$ python manage.py syncdb 
Creating tables ... 
The following content types are stale and need to be deleted: 

    polls | choice_choicefield 
    polls | poll_choicefield 

Any objects related to these content types by a foreign key will also 
be deleted. Are you sure you want to delete these content types? 
If you're unsure, answer 'no'. 

    Type 'yes' to continue, or 'no' to cancel: yes 
Installing custom SQL ... 
Installing indexes ... 
Installed 0 object(s) from 0 fixture(s) 

我再同步的DB

localhost:src brendan$ python manage.py syncdb 
Creating tables ... 
Installing custom SQL ... 
Installing indexes ... 
Installed 0 object(s) from 0 fixture(s) 

,我能夠運行服務器

localhost:src brendan$ python manage.py runserver 
Validating models... 

0 errors found 

當我試圖重溫應用程序在我的瀏覽器中我得到

ImportError at /polls/ 

No module named polls_ChoiceField.urls 

Request Method:  GET 
Request URL: http://localhost:8000/polls/ 
Django Version:  1.6.2 
Exception Type:  ImportError 
Exception Value:  

No module named polls_ChoiceField.urls 

Exception Location:  /Library/Python/2.7/site-packages/django/utils/importlib.py in import_module, line 40 
Python Executable: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 
Python Version:  2.7.6 
Python Path:  

['/Users/brendan/Dropbox/workspace/bias_experiment/src', 
'/Library/Python/2.7/site-packages/distribute-0.7.3-py2.7.egg', 
'/Library/Python/2.7/site-packages/setuptools-2.2-py2.7.egg', 
'/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg', 
'/Library/Python/2.7/site-packages/yolk-0.4.3-py2.7.egg', 
'/Library/Python/2.7/site-packages/virtualenv-1.11.4-py2.7.egg', 
'/Library/Python/2.7/site-packages/virtualenvwrapper-4.2-py2.7.egg', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', 
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', 
'/Library/Python/2.7/site-packages'] 

Server time: Mon, 28 Apr 2014 16:26:46 +0100 

感謝

編輯: 我用的代碼壞線(中間的URL)再次

urlpatterns = patterns('', 
    url(r'^polls/', include('polls.urls', namespace="polls")), 
    url(r'^polls_ChoiceField/', include('polls_ChoiceField.urls', namespace="polls_ChoiceField")), 
    url(r'^admin/', include(admin.site.urls)), 
) 

感謝urls.py。

+0

顯示您的'urls.py'和'INSTALLED_APPS'設置。 – alecxe

+0

已排序!就是這樣。我有一個頂級的urls.py指向每個仍然引用舊應用程序的子應用程序。 如果你添加這個答案我會接受它。謝謝 – Deepend

回答

3

檢查您的項目級別urls.py,看起來它仍然嘗試從已刪除的應用程序中使用urls

相關問題