django - too many options when lanuching dbshell sqlite3

后端 未结 2 678
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 04:37

I have django 1.2.3.0 Final and I am using Python 2.7

In my setting, I have \'sqlite3\' filled for the DATABASE_ENGINE. I am able to work with the sqlite3 (at the level

相关标签:
2条回答
  • 2021-01-21 05:21

    The root problem (still there in django 1.3.1) is that the code that execs the sqlite3 client doesn't deal with spaces in the sqlite db pathname. I added some quotes as follows:

    django.db.backends.sqlite3/client.py

    class DatabaseClient(BaseDatabaseClient):
            executable_name = 'sqlite3'
    
            def runshell(self):
                args = [self.executable_name,
                        '"' + self.connection.settings_dict['NAME'] + '"'] # JA HACK 
                if os.name == 'nt':
                    sys.exit(os.system(" ".join(args)))
                else:
                    os.execvp(self.executable_name, args)
    

    and it now works for me (only tested Windows - os.name 'nt').

    0 讨论(0)
  • 2021-01-21 05:34

    The asker answered his own question here.

    0 讨论(0)
提交回复
热议问题