Leerix
Leerix

Reputation: 55

Django--HELP. django not creating sqlite database file as expected

New to django

following tutorial 1. also looked up all related questions on stack overflow. thought it was a absolute path issue...but absolute path seems to be correct. below is settings.py. any ideas?

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql',    'sqlite3' or 'oracle'.
        'NAME': 'Users/Leerix/cars/carfilter/database/temp.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.
    }

Below is the error i'm getting. Been at this for several hours and cannot find the bug. any help is greatly appreciated. Thx

python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 420,  in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 196, in   run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 371, in   handle
    return self.handle_noargs(**options)
  File "/Library/Python/2.5/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/Library/Python/2.5/site-packages/django/db/backends/__init__.py", line 306, in  cursor
        cursor = self.make_debug_cursor(self._cursor())
      File "/Library/Python/2.5/site-packages/django/db/backends/sqlite3/base.py", line 259, in _cursor
        self.connection = Database.connect(**kwargs)   
sqlite3.OperationalError: unable to open database file

Upvotes: 0

Views: 3265

Answers (2)

Sunjay Varma
Sunjay Varma

Reputation: 5115

Delete the database file at that location. Also, the path starting with Users isn't absolute (is it?) make sure if you're on windows that it starts with a drive letter. (C:\)

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

Perhaps you meant to use an absolute path (one starting with /) instead of a relative path.

Upvotes: 2

Related Questions