tags:

views:

172

answers:

3

Am having a bit of a problem making my django application run in SUSE linux 9. I have Python2.5 installed well, Django 1.0 installed well. Am able to execute django command django-admin startproject fine

But when i run the runserver command i get the error below. i have a folder with sqlite3, i can go in there and actually run the sqlite3* application, now am wondering where does Django look for the sqlite libraries? and how can i fix this?

Validating models...
Unhandled exception in thread started by <function inner_run at 0x2a96cb4f50>
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/django/core/management/commands/runserver.py", line 48, in inner_run
    self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.5/site-packages/django/core/management/base.py", line 122, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.5/site-packages/django/core/management/validation.py", line 22, in get_validation_errors
    from django.db import models, connection
  File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py", line 16, in <module>
    backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, {}, [''])
  File "/usr/local/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 27, in <module>
    raise ImproperlyConfigured, "Error loading %s module: %s" % (module, exc)
django.core.exceptions.ImproperlyConfigured: Error loading sqlite3 module: No module named _sqlite3

Gath

A: 

It sounds like you have the sqlite3 application, but not the Python libraries. Since they usually come as part of the Python distribution for versions 2.5 upwards, the likelihood is that you have a minimal Python install.

I don't know anything about how SUSE deals with packages, but try installing the Python-dev package or equivalent.

(Also note that SUSE 9 seems like a very old version - it's currently up to 11. You might want to upgrade your whole system.)

Daniel Roseman
A: 

Just like for all other libraries, django looks for what you ask in and only in your PYTHON_PATH.

Update: In order to do a quickfix to your program to work, you might want to edit the sys.path manually.

import sys
sys.path.insert(1,'/path/to/folder/that/has/init/')

You can do this within manage.py

Better it is, however, to install it in the standard site_packages folder.

I'd suggest, use pip and let it handle all that for you.

pip install sqlite3
Lakshman Prasad
$ pip install sqlite3Downloading/unpacking sqlite3 Could not find any downloads that satisfy the requirement sqlite3No distributions at all found for sqlite3sqlite3 doesn't appear to be installable with pip :(
Peter Bengtsson
A: 

Sounds like you didn't have the sqlite3-devel package installed when you built Python. Install that package, rebuild Python, then try again.

Ignacio Vazquez-Abrams