Fixed error in main script when using other database engine. Fixed #1166.

This commit is contained in:
Norman Jäckel 2014-01-11 08:50:52 +01:00
parent 5c44a279fc
commit 19ccbd3b17
3 changed files with 9 additions and 7 deletions

View File

@ -15,6 +15,7 @@ Files:
Other: Other:
- Fixed http status code when requesting a non-existing static page using - Fixed http status code when requesting a non-existing static page using
Tordado web server. Tordado web server.
- Fixed error in main script when using other database engine.
Version 1.5 (2013-11-25) Version 1.5 (2013-11-25)

View File

@ -243,12 +243,13 @@ def syncdb(settings, args):
ensure_settings(settings, args) ensure_settings(settings, args)
# TODO: Check use of filesystem2unicode here. # TODO: Check use of filesystem2unicode here.
db_file = get_database_path_from_settings() db_file = get_database_path_from_settings()
db_dir = filesystem2unicode(os.path.dirname(db_file)) if db_file is not None:
if not os.path.exists(db_dir): db_dir = filesystem2unicode(os.path.dirname(db_file))
os.makedirs(db_dir) if not os.path.exists(db_dir):
if not os.path.exists(db_file): os.makedirs(db_dir)
print('Clearing old search index...') if not os.path.exists(db_file):
execute_from_command_line(["", "clear_index", "--noinput"]) print('Clearing old search index...')
execute_from_command_line(["", "clear_index", "--noinput"])
execute_from_command_line(["", "syncdb", "--noinput"]) execute_from_command_line(["", "syncdb", "--noinput"])
return 0 return 0

View File

@ -360,7 +360,7 @@ def get_database_path_from_settings():
raise DatabaseInSettingsError("Default databases is not configured") raise DatabaseInSettingsError("Default databases is not configured")
database_path = default.get('NAME') database_path = default.get('NAME')
if not database_path: if not database_path:
raise DatabaseInSettingsError('No path specified for default database.') raise DatabaseInSettingsError('No path or name specified for default database.')
if default.get('ENGINE') != 'django.db.backends.sqlite3': if default.get('ENGINE') != 'django.db.backends.sqlite3':
database_path = None database_path = None
return database_path return database_path