Найти - Пользователи
Полная версия: не работает syncdb
Начало » Django » не работает syncdb
1 2
-den-
Всем привет! Начал осваивать python+django и сразу же столкнулся с проблемой(( Делаю все как описано здесь - http://djbook.ru/rel1.6/index.html, дохожу до момента python manage.py syncdb и получаю вот такое сообщение
c:\myProjects\mysite>python manage.py syncdb
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\base.py", line 285, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\base.py", line 415, in handle
return self.handle_noargs(**options)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\commands\syncdb.py", line 112, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\sql.py", line 216, in emit_post_sync_signal
interactive=interactive, db=db)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\dispatch\dis
patcher.py", line 185, in send
response = receiver(signal=self, sender=sender, **named)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\auth
\management\__init__.py", line 101, in create_permissions
auth_app.Permission.objects.using(db).bulk_create(perms)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\qu
ery.py", line 359, in bulk_create
self._batched_insert(objs_without_pk, fields, batch_size)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\qu
ery.py", line 838, in _batched_insert
using=self.db)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\ma
nager.py", line 232, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\qu
ery.py", line 1514, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\sq
l\compiler.py", line 903, in execute_sql
cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\backends\
util.py", line 69, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\backends\
util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\utils.py"
, line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\backends\
util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\backends\
sqlite3\base.py", line 451, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: unable to open database file
уже 2 дня бьюсь ничего не помогает, нагуглить тож не получается((
Операционная система - Win7, антивирус отключен.
Помогите, пожалуйста. может кто сталкивался!!!
pood
что прописано в DATABASES = {….} в settings.py ?
-den-
прописано следующее
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
Пробовал напрямую путь писать, различные варианты со слешами и бэк-слешами, что-то ничего не помогло…
pood
а какой путь к проекту? пробелов в пути нет ?
pood
попробуй сократить имя БД ‘ENGINE’: ‘backends.sqlite3’
-den-
путь c:\myProjects\mysite\, но часть таблиц-то создается и сам файл db.sqlite3 есть, но насколько я понял он не полный.
вот какой файл
SQLite format 3@  	сыцсK_9indexsqlite_autoindex_auth_group_permissions_1auth_group_permissions‚++ѓStableauth_permissionauth_permissionCREATE TABLE "auth_permission" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(50) NOT NULL,
"content_type_id" integer NOT NULL,
"codename" varchar(100) NOT NULL,
UNIQUE ("content_type_id", "codename")
)=Q+indexsqlite_autoindex_auth_permission_1auth_permission‚k--… tabledjango_admin_logdjango_admin_logCREATE TABLE "django_admin_log" (
"id" integer NOT NULL PRIMARY KEY,
"action_time" datetime NOT NULL,
"user_id" integer NOT NULL,
"content_type_id" integer,
"object_id" text,
"object_repr" varchar(200) NOT NULL,
"action_flag" smallint unsigned NOT NULL,
"change_message"






""ђЎас‚k--… tabledjango_admin_logdjango_admin_logCREATE TABLE "django_admin_log" (
"id" integer NOT NULL PRIMARY KEY,
"action_time" datetime NOT NULL,
"user_id" integer NOT NULL,
"content_type_id" integer,
"object_id" text,
"object_repr" varchar(200) NOT NULL,
"action_flag" smallint unsigned NOT NULL,
"change_message" text NOT NULL
)‚++ѓStableauth_permissionauth_permissionCREATE TABLE "auth_permission" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(50) NOT NULL,
"content_type_id" integer NOT NULL,
"codename" varchar(100) NOT NULL,
UNIQUE ("content_type_id", "codename")
)=Q+indexsqlite_autoindex_auth_permission_1auth_permission‚99ѓUtableauth_group_permissionsauth_group_permissionsCREATE TABLE "auth_group_permissions" (
"id" integer NOT NULL PRIMARY KEY,
"group_id" integer NOT NULL,
"permission_id" integer NOT NULL REFERENCES "auth_permission" ("id"),
UNIQUE ("group_id", "permission_id")
)
‡‡Фc˜•Ц«§‚'
K_9indexsqlite_autoindex_auth_group_permissions_1auth_group_permissionsЃ !!K_9indexsqlite_autoindex_auth_group_permissions_1auth_group_permissionsЃ !!Ѓctableauth_groupauth_group CREATE TABLE "auth_group" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(80) NOT NULL UNIQUE
)3G!indexsqlite_autoindex_auth_group_1auth_group
Ѓz--ѓ'tableauth_user_groupsauth_user_groups CREATE TABLE "auth_user_groups" (
"id" integer NOT NULL PRIMARY KEY,
"user_id" integer NOT NULL,
"group_id" integer NOT NULL REFERENCES "auth_group" ("id"),
UNIQUE ("user_id", "group_id")
)? S-indexsqlite_autoindex_auth_user_groups_1auth_user_groups ‚'
AAѓYtableauth_user_user_permissionsauth_user_user_permissions
CREATE TABLE "auth_user_user_permissions" (
"id" integer NOT NULL PRIMARY KEY,
"user_id" integer NOT NULL,
"permission_id" integer NOT NULL REFERENCES "auth_permission" ("id"),
UNIQUE ("user_id", "permission_id")
)








љљпјпГГѓJ †ctableauth‚33ѓCtabledjango_coѓJ †ctableauth_userauth_userCREATE TABLE "autS gAindexsqlite_autoindex_auth_user_user_permissions_1auth_user_user_permissionsѓJ †ctableauth_userauth_userCREATE TABLE "auth_user" (
"id" integer NOT NULL PRIMARY KEY,
"password" varchar(128) NOT NULL,
"last_login" datetime NOT NULL,
"is_superuser" bool NOT NULL,
"username" varchar(30) NOT NULL UNIQUE,
"first_name" varchar(30) NOT NULL,
"last_name" varchar(30) NOT NULL,
"email" varchar(75) NOT NULL,
"is_staff" bool NOT NULL,
"is_active" bool NOT NULL,
"date_joined" datetime NOT NULL
)1
Eindexsqlite_autoindex_auth_user_1auth_user‚33ѓCtabledjango_content_typedjango_content_typeCREATE TABLE "django_content_type" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(100) NOT NULL,
"app_label" varchar(100) NOT NULL,
"model" varchar(100) NOT NULL,
UNIQUE ("app_label", "model")
)
ггlog entryadminlogentry
ннadminlogentry


µµьГEY3indexsqlite_autoindex_django_content_type_1django_content_typeЃD))‚Ctabledjango_sessiondjango_sessionCREATE TABLE "django_session" (
"session_key" varchar(40) NOT NULL PRIMARY KEY,
"session_data" text NOT NULL,
"expire_date" datetime NOT NULL
);O)indexsqlite_autoindex_django_session_1django_session

pood
попробуй сократить имя БД ‘ENGINE’: ‘backends.sqlite3’
вот что написал:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\core\managem
ent\base.py", line 280, in execute
translation.activate('en-us')
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\utils\transl
ation\__init__.py", line 130, in activate
return _trans.activate(language)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\utils\transl
ation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\utils\transl
ation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\utils\transl
ation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\utils\import
lib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\admi
n\__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\admi
n\sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\admi
n\forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\auth
\forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\contrib\auth
\models.py", line 48, in <module>
class Permission(models.Model):
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\ba
se.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\ba
se.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\models\op
tions.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length(
))
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\__init__.
py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\utils.py"
, line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python27\lib\site-packages\django-1.6.5-py2.7.egg\django\db\utils.py"
, line 131, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'backends.sqlite3' isn't an availab
le database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: No module named backends.sqlite3.base
pood
попробуй сократить имя БД ‘ENGINE’: ‘backends.sqlite3’
упс, это я конечно протупил, перепутал с именем БД
pood
а что в INSTALLED_APPS прописано ?
pood
-den-
Пробовал напрямую путь писать, различные варианты со слешами и бэк-слешами, что-то ничего не помогло…
так тоже пробовал “c:\\myProjects\\mysite\\db.sqlite3”
-den-
pood
а что в INSTALLED_APPS прописано ?
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
Все по-умолчанию, как создалось командой django-admin.py startproject mysite

pood
так тоже пробовал “c:\\myProjects\\mysite\\db.sqlite3”
Да, так тоже пробовал и с буквой “r” перед названием пути…
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB