2013-07-24 89 views
1

我在Django 1.5.1上運行一個示例站點,但我在創建名爲「網站」的Django應用程序時得到ImportError。這是我的應用程序Heirarchy。Python的Django的ImportError:沒有模塊命名的網站

TrackLeech 
    -- __init__.py 
    -- manage.py 
    TrackLeech 
    -- __init__.py 
    -- setting.py 
    -- urls.py 
    -- wsgi.py 
    website 
    -- __init__.py 
    -- models.py 
    -- tests.py 
    -- views.py 
    templates 
     -- index.html 

現在,當我運行命令,服務器將在8000端口開始很好,但本地主機:8000頁顯示導入錯誤

$ python manage.py runserver

Validating models... 

0 errors found 
July 24, 2013 - 13:29:03 
Django version 1.5.1, using settings 'TrackLeech.settings' 
Development server is running at http://127.0.0.1:8000/ 
Quit the server with CONTROL-C. 
Internal Server Error:/
Traceback (most recent call last): 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site-    packages/Django-1.5.1-py2.7.egg/django/core/handlers/base.py", line 103, in get_response 
    resolver_match = resolver.resolve(request.path_info) 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 321, in resolve 
    sub_match = pattern.resolve(new_path) 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 223, in resolve 
    return ResolverMatch(self.callback, args, kwargs, self.name) 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 230, in callback 
    self._callback = get_callable(self._callback_str) 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/utils/functional.py", line 29, in wrapper 
    result = func(*args) 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/core/urlresolvers.py", line 101, in get_callable 
    not module_has_submodule(import_module(parentmod), submod)): 
    File "/home/chitrank/Documents/Google_App_Engine/venv/local/lib/python2.7/site- packages/Django-1.5.1-py2.7.egg/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
ImportError: No module named website 

我我無法確定這是新的Django版本1.5中的錯誤.1或者我是以不同的方式創建模塊,或者我應該重新安裝Django還是應該使用其他Django版本。請建議我是否需要更改我正在使用的Django?

+1

是在'INSTALLED_APPS'網站? – karthikr

+0

是的我已經在INSTALLED_APPS中列出了我的django應用程序。 –

+1

你是否遵循正確的文檔來啓動你的d​​jango項目?導致它從1版本變化到另一個版本。 – nnaelle

回答

0

您必須確保以基本方式創建應用程序:python manage.py startapp網站並在設置INSTALLED_APPS中設置應用程序的名稱。

+0

我已經在INSTALLED_APPS =(...'網站')中設置了應用程序名稱 –

0

嘿我還面臨着與「登錄」名稱相同的問題。

我的應用程序名稱是「登錄」,並具有相同的feature.py。

當我嘗試使用

from login import feature 

IDE沒有表現出任何問題導入功能。 intellisense工作正常。

但是當我試圖runserver它引發ImportError:沒有模塊命名的功能。 ,只要我改變登錄到extended_login它的工作。

所以我認爲一些關鍵字作爲應用程序名稱是不可接受的。您嘗試更改您的應用名稱。

相關問題