I figured it out.
Details:
I had set environment variable PYTHONPATH to help Django
find the sql_server.pyodbc files needed to make a connection
to a Microsoft SQL Server DB. This was keeping SQLite from
working properly. When I cleared the environment variable,
SQLite works fine.
I now get no errors when I do:
>>> import sqlite3
>>> from sqlite3 import dbapi2
and I no longer get the error about dbapi2 when I run my
regression tests via Django.
To get the sql_server.pyodbc file to be found, I now use a
symlink:
% ln -s django/db/backends/sql_server \
~/python/virtualenvs/hhl/lib/python2.7/site-packages/sql_server
instead of setting PYTHONPATH:
% setenv PYTHONPATH ~/python/virtualenvs/hhl/lib/python2.7/site-packages/django/db/backends
FYI,
Details:
I had set environment variable PYTHONPATH to help Django
find the sql_server.pyodbc files needed to make a connection
to a Microsoft SQL Server DB. This was keeping SQLite from
working properly. When I cleared the environment variable,
SQLite works fine.
I now get no errors when I do:
>>> import sqlite3
>>> from sqlite3 import dbapi2
and I no longer get the error about dbapi2 when I run my
regression tests via Django.
To get the sql_server.pyodbc file to be found, I now use a
symlink:
% ln -s django/db/backends/sql_server \
~/python/virtualenvs/hhl/lib/python2.7/site-packages/sql_server
instead of setting PYTHONPATH:
% setenv PYTHONPATH ~/python/virtualenvs/hhl/lib/python2.7/site-packages/django/db/backends
FYI,
--Fred
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 8/25/14 9:30 AM, Fred Stluka wrote:Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
I'm getting error:
django.core.exceptions.ImproperlyConfigured:
Error loading either pysqlite2 or sqlite3 modules
(tried in that order): cannot import name dbapi2
Any suggestions?
Details:
My settings.py contains:
DATABASE = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/Users/fred/fred/HHL/HHLWeb/sqlite3.db'
}
}
Works fine with other DBs (MySQL, MS SQL Server, etc.), but now
I'm trying to switch to SQLite for faster testing.
From the command line, I can see that sqlite3 is installed
(by default as part of the Django install), but seems to not
contain dbapi2:
>>> import sqlite3
>>> from sqlite3 import dbapi2
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name dbapi2
Any ideas for me? Any suggestions on how to narrow down
the problem? Any more info I should give you?
Thanks!
--Fred
No comments:
Post a Comment