-4

私は django の初心者です。現在、Django を使用した Python Web 開発という本を読んで、軽いブログを作成しています。テスト用にアプリブログと 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()

stackoverflow で同様の質問を検索しましたが、それらの解決策はうまくいきません。

4

1 に答える 1

1

ブログのみを試す:

INSTALLED_APPS = (
    .......
    'blog',
    ......
)
于 2013-03-10T11:04:38.023 に答える