Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django:没有名为blog的模块_Django - Fatal编程技术网

Django:没有名为blog的模块

Django:没有名为blog的模块,django,Django,对不起,我问了这样一个问题。但是搜索对我没有帮助 我做到了: django-admin.py startproject mysite ./manage.py startapp blog 那么现在我可以看到, michael@ubuntu:~/PycharmProjects/mysite$ ls -l total 12 drwxrwxr-x 2 michael michael 4096 Oct 2 08:22 blog -rwxr-xr-x 1 michael michael 249 Oct

对不起,我问了这样一个问题。但是搜索对我没有帮助

我做到了:

django-admin.py startproject mysite
./manage.py startapp blog
那么现在我可以看到,

michael@ubuntu:~/PycharmProjects/mysite$ ls -l
total 12
drwxrwxr-x 2 michael michael 4096 Oct  2 08:22 blog
-rwxr-xr-x 1 michael michael  249 Oct  2 08:14 manage.py
drwxrwxr-x 2 michael michael 4096 Oct  2 08:26 mysite
在settings.py中,我添加了我的博客:

INSTALLED_APPS = (

    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mysite.blog',
然后提到SQlite:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': '/var/db/django.db',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}
然后我编辑了models.py

从django.db导入模型:

class BlogPost(models.Model):
    title = models.CharField(max_length = 150)
    body = models.TextField()
    timestamp = models.DateTimeField()
嗯,当我这样做的时候:

./manage.py syncdb
我得到:

Error: No module named blog

你能帮我解决这个问题吗?

在已安装的应用程序中,你只需要“blog”而不是“mysite.blog”。这应该可以解决您的问题。

已安装的应用程序中添加
博客
,而不是
'mysite.blog'

sqlite3.0错误:无法打开数据库文件


表示权限问题。确保您在
/var/db/

中拥有必要的权限,这似乎有点帮助。但同时还有另一个问题:sqlite3.OperationalError:无法打开数据库文件检查您是否有足够的权限写入数据库文件
/var/DB/django.DB