无模块命名的博客

问题描述:

我在django.Now我下面一个名为的Python Web开发Django的书和blog.With应用博客和sqlite3的选择创建用于测试的光一个新手,运行./manage.py syncdb时出现错误。无模块命名的博客

的错误是,

Error: No module named blog 

这是我settings.py

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'mysite.blog', 
    # Uncomment the next line to enable the admin: 
    # 'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 

) 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': '/var/db/django.db',      # Or path to database file if using sqlite3. 
     'USER': '',      # Not used with sqlite3. 
     'PASSWORD': '',     # Not used with sqlite3. 
     'HOST': '',      # Set to empty string for localhost. Not used with sqlite3. 
     'PORT': '',      # Set to empty string for default. Not used with sqlite3. 
    } 
} 

部分这里是所有model.py在博客应用:

from django.db import models 

class BlogPost(models.Model): 
    title = models.CharField(max_length = 150) 
    body = models.TextField() 
    timestamp = models.DataTimeField() 

我已经通过*中的类似问题进行了搜索,但那些决议对我不起作用。

+1

究竟是什么错误? – shx2 2013-03-10 10:50:34

+0

我希望你的代码缩进是好的,因为它看起来像它不是 – apoq 2013-03-10 10:52:51

+0

@Kapo我刚刚从我的脚本粘贴它。它一定会好起来的。 – Edward 2013-03-10 10:59:26

尝试仅仅博客:

INSTALLED_APPS = (
    ....... 
    'blog', 
    ...... 
) 
+0

谢谢,它的工作原理。但你怎么知道去掉'神秘'。帮助? – Edward 2013-03-10 15:00:26

+0

它将取决于您的设置的路径 – catherine 2013-03-10 15:10:34