Reputation: 3843
Well, pardon for asking such a question. But searching didn't help me.
I did:
django-admin.py startproject mysite
./manage.py startapp blog
Well, now I can see:
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
In settings.py I added my blog:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysite.blog',
Then mentioned SQlite:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/var/db/django.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
Then I edited models.py
from django.db import models:
class BlogPost(models.Model):
title = models.CharField(max_length = 150)
body = models.TextField()
timestamp = models.DateTimeField()
Well, when I do:
./manage.py syncdb
I get:
Error: No module named blog
Could you help me cope with this?
Upvotes: 0
Views: 3620
Reputation: 2450
sqlite3.OperationalError: unable to open database file
indicates a permission problem. make sure you have necessary permissions in /var/db/
Upvotes: 0
Reputation: 2450
In INSTALLED_APPS, you need to have just 'blog' instead of 'mysite.blog'. That should fix your problem.
Upvotes: 3