2013-07-24 43 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它的工作。

所以我认为一些关键字作为应用程序名称是不可接受的。您尝试更改您的应用名称。

相关问题