1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python and Django fails to run [python manage.py sql application]

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    Traceback (most recent call last):
    File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
    File "D:\PythonPack\lib\site-packages\django\core\management\__init__.py", lin
    e 443, in execute_from_command_line
    utility.execute()
    File "D:\PythonPack\lib\site-packages\django\core\management\__init__.py", lin
    e 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "D:\PythonPack\lib\site-packages\django\core\management\base.py", line 19
    6, in run_from_argv
    self.execute(*args, **options.__dict__)
    File "D:\PythonPack\lib\site-packages\django\core\management\base.py", line 23
    2, in execute
    output = self.handle(*args, **options)
    File "D:\PythonPack\lib\site-packages\django\core\management\base.py", line 30
    4, in handle
    app_output = self.handle_app(app, **options)
    File "D:\PythonPack\lib\site-packages\django\core\management\commands\sqlall.p
    y", line 19, in handle_app
    return u'\n'.join(sql_all(app, self.style, connections[options.get('database
    ')])).encode('utf-8')
    File "D:\PythonPack\lib\site-packages\django\core\management\sql.py", line 145
    , in sql_all
    return sql_create(app, style, connection) + sql_custom(app, style, connectio
    n) + sql_indexes(app, style, connection)
    File "D:\PythonPack\lib\site-packages\django\core\management\sql.py", line 26,
    in sql_create
    tables = connection.introspection.table_names()
    File "D:\PythonPack\lib\site-packages\django\db\backends\__init__.py", line 89
    5, in table_names
    cursor = self.connection.cursor()
    File "D:\PythonPack\lib\site-packages\django\db\backends\__init__.py", line 30
    6, in cursor
    cursor = self.make_debug_cursor(self._cursor())
    File "D:\PythonPack\lib\site-packages\django\db\backends\sqlite3\base.py", lin
    e 281, in _cursor
    self._sqlite_create_connection()
    File "D:\PythonPack\lib\site-packages\django\db\backends\sqlite3\base.py", lin
    e 271, in _sqlite_create_connection
    self.connection = Database.connect(**kwargs)
    sqlite3.OperationalError: unable to open database file


    I follow this tutorial https://docs.djangoproject.com/en/dev/intro/tutorial01/ and I run into the above errors when trying to execute the command

    python manage.py sql polls


    Anyone knows what might be the problem ? Thank you a lot.

    ANAGERS = ADMINS

    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'E:\Python\mysite\sqlitedb', # 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.
    }
    }



    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    'polls',
    )

    Continue reading...

Compartilhe esta Página