the following code:
class CreateSurveyFromCsvTextTests(TestCase):
def test_parses_survey_passed_in_as_csv_and_returns_xml_representation(self):
self.assertTrue(True)
throws the following error:
ERROR: test_parses_survey_passed_in_as_csv_and_returns_xml_representation (dkobo.formbuilder.tests.CreateSurveyFromCsvTextTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/test/testcases.py", line 178, in __call__
self._pre_setup()
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/test/testcases.py", line 749, in _pre_setup
self._fixture_setup()
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/test/testcases.py", line 861, in _fixture_setup
if not connections_support_transactions():
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/test/testcases.py", line 848, in connections_support_transactions
for conn in connections.all())
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/test/testcases.py", line 848, in <genexpr>
for conn in connections.all())
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.func.__name__] = self.func(instance)
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 664, in supports_transactions
self.connection.leave_transaction_management()
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 317, in leave_transaction_management
if managed == self.get_autocommit():
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 324, in get_autocommit
self.ensure_connection()
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 124, in ensure_connection
self.connect()
File "/home/nico/.virtualenvs/kf/local/lib/python2.7/site-packages/django/db/utils.py", line 86, in __exit__
db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
AttributeError: 'DatabaseWrapper' object has no attribute 'Database'
----------------------------------------------------------------------
I know this doesn't tell you much about the problem, and it's probably an environment problem, but I'm new to Linux/Python (switched from Windows/.Net 7 days ago) and wouldn't really know where to start gathering information, let alone diagnosing the error.
The problem was that the database was not configured. Adding the default entry for DATABASE
in settings.py
and the running python manage.py syncdb
fixed it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.