i am using sqlite3 for my django app. BUT I have problems installing
it. Here are my configs:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
win32-x86-3071000\test.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.
}
}
I tried this:
>>> from django.db import connection
>>> cursor = connection.cursor()
But I got this error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py",
line 250,
in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python27\lib\site-packages\django\db\backends
\sqlite3\base.py", line
207, in _cursor
self.connection = Database.connect(**kwargs)
OperationalError: unable to open database file
After specifying the path to where you want your sqlite database to be i.e db name setting, after your syncdb, the database will be created automatically if it doesn't already exist in the path you stated.
On 2/13/12, Marcus Maximus <marcus.pres...@gmail.com> wrote:
> i am using sqlite3 for my django app. BUT I have problems installing > it. Here are my configs:
> DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.sqlite3', # Add > 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. > 'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell- > win32-x86-3071000\test.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. > } > }
> I tried this:
>>>> from django.db import connection >>>> cursor = connection.cursor()
> But I got this error:
> Traceback (most recent call last): > File "<console>", line 1, in <module> > File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", > line 250, > in cursor > cursor = self.make_debug_cursor(self._cursor()) > File "C:\Python27\lib\site-packages\django\db\backends > \sqlite3\base.py", line > 207, in _cursor > self.connection = Database.connect(**kwargs) > OperationalError: unable to open database file
> Can sb show me a better way to create an empty sqlite3 db file?
> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en.
> i am using sqlite3 for my django app. BUT I have problems installing
> it. Here are my configs:
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell-
> win32-x86-3071000\test.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.
> }
>> DATABASES = { >> 'default': { >> 'ENGINE': 'django.db.backends.sqlite3', # Add >> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >> 'NAME': 'test.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. >> }
> On Feb 13, 4:50 am, Marcus Maximus <marcus.pres...@gmail.com> wrote: >> Hey guys,
>> i am using sqlite3 for my django app. BUT I have problems installing >> it. Here are my configs:
>> DATABASES = { >> 'default': { >> 'ENGINE': 'django.db.backends.sqlite3', # Add >> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >> 'NAME': 'C:\Users\Maximus\Desktop\Webseite\Django\sqlite-shell- >> win32-x86-3071000\test.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. >> }
>> }
>> I tried this:
>>>>> from django.db import connection >>>>> cursor = connection.cursor()
>> But I got this error:
>> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", >> line 250, >> in cursor >> cursor = self.make_debug_cursor(self._cursor()) >> File "C:\Python27\lib\site-packages\django\db\backends >> \sqlite3\base.py", line >> 207, in _cursor >> self.connection = Database.connect(**kwargs) >> OperationalError: unable to open database file
>> Can sb show me a better way to create an empty sqlite3 db file?
> -- > You received this message because you are subscribed to the Google Groups "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/django-users?hl=en.