Using sqlite3 to test locally

1,035 views
Skip to first unread message

Zo

unread,
Jul 28, 2010, 12:16:32 PM7/28/10
to Django users
Hello,

I am trying to configure my django project to use sqlite3. As of now I
do not have database creation permission for SQL, so i decided to try
and do my prototyping locally. I set the following:

DATABASES = {
'default' : {
'NAME' : 'C:/python-dev/pythonproject/test/sqlite3.db'
,'ENGINE' : 'django.db.backends.sqlite3'
}
}

when i run ./manage.py test

> django.db.utils.ConnectionDoesNotExist: The connection ReportAdmin doesn't exist

I also tried

DATABASES = {
'default' : {
'NAME' : 'C:/python-dev/pythonproject/test/sqlite3.db'
,'ENGINE' : 'django.db.backends.sqlite3'
}
,'ReportAdmin' : {
'NAME' : 'C:/python-dev/pythonproject/test/sqlite3.db'
,'ENGINE' : 'django.db.backends.sqlite3'
}
}

then i get

> django.db.utils.DatabaseError: no such table: django_content_type

I just want to do my testing locally; I must be missing something...
Any help would be appreciated. I am hoping to convince my company that
django is the way to go, but I can't do that without a nice
prototype.

Bonus question: Using PyDev in eclipse, how do you execute
doctests?!?!

Thank you in advance for your time,
Zo

System specs:
Python 2.6
Django 1.2.1
Windows XP
Eclipse 3.5.2

If you need extra information please let me know.

Shawn Milochik

unread,
Jul 28, 2010, 12:20:18 PM7/28/10
to django...@googlegroups.com
Did you run ./manage.py syncdb?

Zo

unread,
Jul 28, 2010, 12:43:55 PM7/28/10
to Django users
I had not, i ran it and created a superuser. should I be changing my
setting file for my user info?

I also changed DATABASE_ROUTERS = [] because it was previously set to
['test.ReportAdmin.routers.ReportAdminRouter']

and I went back to

DATABASES = {
'default' : {
'NAME' : 'C:/python-dev/pythonproject/test/sqlite3.db'
,'ENGINE' : 'django.db.backends.sqlite3'
}

}

those changes caused my tests to actually run, but now I get lots of
tests...

----------------------------------------------------------------------
Ran 59 tests in 0.828s

FAILED (failures=16, errors=4)
Destroying test database 'default'...

It looks like all failures come from Python26/lib/site-packages/django/
contrib/auth/tests

Here are a few of the errors/failures

======================================================================
ERROR: test_no_remote_user
(django.contrib.auth.tests.remote_user.RemoteUserCust
omTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\remote_user.py",
line 33, in test_no_remote_user
self.assert_(response.context['user'].is_anonymous())
TypeError: 'NoneType' object is unsubscriptable

======================================================================
ERROR: test_no_remote_user
(django.contrib.auth.tests.remote_user.RemoteUserNoCr
eateTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\remote_user.py",
line 33, in test_no_remote_user
self.assert_(response.context['user'].is_anonymous())
TypeError: 'NoneType' object is unsubscriptable

======================================================================
ERROR: test_unknown_user
(django.contrib.auth.tests.remote_user.RemoteUserNoCrea
teTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\remote_user.py",
line 118, in test_unknown_user
self.assert_(response.context['user'].is_anonymous())
TypeError: 'NoneType' object is unsubscriptable

======================================================================
ERROR: test_no_remote_user
(django.contrib.auth.tests.remote_user.RemoteUserTest
)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\remote_user.py",
line 33, in test_no_remote_user
self.assert_(response.context['user'].is_anonymous())
TypeError: 'NoneType' object is unsubscriptable

======================================================================
FAIL: test_password_change_fails_with_invalid_old_password
(django.contrib.auth.
tests.views.ChangePasswordTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\views.py", line
143, in test_password_change_fails_with_invalid_old_password
self.login()
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\views.py", line
127, in login
self.assertEquals(response.status_code, 302)
AssertionError: 200 != 302

======================================================================
FAIL: test_password_change_fails_with_mismatched_passwords
(django.contrib.auth.
tests.views.ChangePasswordTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\views.py", line
154, in test_password_change_fails_with_mismatched_passwords
self.login()
File "C:\Python26\lib\site-packages\django\contrib\auth\tests
\views.py", line
127, in login
self.assertEquals(response.status_code, 302)




Can i disable these or should all these be passing?



Thanks,
Zo

Zo

unread,
Jul 29, 2010, 10:49:18 AM7/29/10
to Django users
I fixed this by commenting out 'django.contrib.auth' from
INSTALLED_APPS in settings.py

Also, to run doctests in PyDev for eclipse, all you need to do is go
to run configuration and add -v as an argument.
Then right click on the file with the doctest and run as 'Python Run'

Hope this helps anyone else with these problems.
Reply all
Reply to author
Forward
0 new messages