ImportError:没有名为core的模块 - 使用Django的Pycharm

时间:2014-05-05 17:29:01

标签: python django pycharm

所以,我正在研究Django,当我试图展示index.html时,我收到了这个错误:

ImportError at /
No module named core
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.6.2
Exception Type: ImportError
Exception Value:    
No module named core
Exception Location: /usr/local/lib/python2.7/site-packages/django/utils/importlib.py in import_module, line 40
Python Executable:  /usr/local/opt/python/bin/python2.7
Python Version: 2.7.6
Python Path:    
['/Users/witalobenicio/PycharmProjects/Teste',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-3.4.1-py2.7.egg',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.9-x86_64.egg',
 '/usr/local/lib/python2.7/site-packages/setuptools-3.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.9-x86_64.egg',
 '/Users/witalobenicio/PycharmProjects/Teste/$PYTHONPATH',
 '/Users/witalobenicio/PycharmProjects/Teste',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-packages',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Library/Python/2.7/site-packages',
 '/usr/local/lib/python2.7/site-packages']
Server time:    Mon, 5 May 2014 17:11:19 +0000

1 个答案:

答案 0 :(得分:0)

问题出在urls.py。

我有这个正则表达式:

url(r'^$', 'Teste.core.views.home', name='home'),

但我必须使用:

url(r'^$', 'core.views.home', name='home'),