tags:

views:

22

answers:

1

Hello, I have found several topics with this title, but none of their solutions worked for me. I have two Django sites running on my server, both through Apache using different virtualhosts on two ports fed by my Nginx frontend (using for static files). One site uses MySql and runs just fine. The other uses Sqlite3 and gets the error in the title.

I downloaded a copy of sqlite.exe and looked at the mysite.sqlite3 (SQLite database in this directory) file and there is indeed a django_session table with valid data in it. I have the sqlite.exe in my system32 as well as the site-packages folder in my Python path.

Here is a section of my settings.py file:

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'mysite.sqlite3',         # 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 did use the python manage.py syncdb with no errors and just a "No Fixtures" comment.

Does anyone have any ideas what else might be going on here? I'm considering just transferring everything over to my old pal MySql and just ignoring Sqlite, as really it's always given me some kind of trouble. I was only using it for the benefit of knowing it anyway. I have no overwhelming reason why I should use it. But again, just for my edification does anyone know what this problem is? I don't like to give up.

A: 

It could be that the server uses a different working directory than the manage.py command. Since you provide a relative path to the sqlite database, it is created in the working directory. Try it with an absolute path, e.g.:

'NAME': '/tmp/mysite.sqlite3',

Remember that you have to either run ./manage.py syncdb again or copy your current database with the existing tables to /tmp.

If it resolves the error message, you can look for a better place than /tmp :-)

piquadrat
actually, I'm running on Windows XP x64 ;) It's my home computer that's the development server. Strangely enough, that worked when it didn't work before. I altered the path to my Python site-packages and it created a new database file, I overwrote that file with the one I already had, and then transferred it back to the mysite folder and changed the settings.py to :'I:/xampp/htdocs/mysite/mysite.sqlite3' in the NAME slot. It worked for some odd reason
F_C
I say that because before I just changed the NAME to that exact thing and it didn't work. But I guess forcing it to make a new database file, even when I just overwrote it with what I already had, woke it up somehow.
F_C