Hi,
I've ran into a really strange error which I'm not able to debug.
On a fresh django-oscar installation (tested with 1.6.4 and 2.0-dev) I'm getting this when I add new product via the dashboard:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 296, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: main.catalogue_product__old
I guess there is some bug in the migrations? I looked into this quite some time and couldn't find the problem.
I prepared a minimal example:
In the extracted folder, run the following commands to init the project and get the same error:
# I tried both the system's pip and virtual envs
pip install django-oscar
python manage.py migrate
# sets up superuser "admin" ([email protected]) with password "admin"
python manage.py loaddata data/auth.json
# this triggers the error
python manage.py loaddata data/catalogue.json
This bug also appears when creating a new product via the dashboard in both oscar 2.0 and 1.6.4...
Any ideas?
I'm not able to reproduce this with the example code you have provided - I get an error loading the catalogue fixture but it's because there is an invalid foreign key relationship.
Oscar does not have a main app, which is what the table main.catalogue_product__old appears to be coming from. Nor does it have any models which would result in that table name.
I think the issue here is that you have a main app in your project, which is perhaps a fork of Oscar's catalogue app, and where there is inconsistent database state.
Thank you for your answer. I think I found the problem. It's a problem with Django and the new alter table command in SQLite 3.26: https://groups.google.com/forum/#!topic/django-updates/htVqH24DImg
Django already has an open pull request for this:
https://github.com/django/django/pull/10733
I did this in pycharm and it did work:
pip install Django --upgrade
Then
python manage.py migrate
python manage.py makemigrations 'app_name'
python manage.py migrate
I did this in pycharm and it did work:
pip install Django --upgrade
Then
python manage.py migrate
python manage.py makemigrations 'app_name'
python manage.py migrate
I m facing the same issue on pycham but its not getting done by this.
I did this in pycharm and it did work:
pip install Django --upgrade
Then
python manage.py migrate
python manage.py makemigrations 'app_name'
python manage.py migrate
Man I could KISS you! I have spent 14 hours trying to debug this problem with another Django app because after 3 days of writing the web server crashes when trying to write to the database. This crash caused over one hundred exceptions to be thrown and I didn't even know where on earth to start.
You are an absolute saint! This fixed my problem one hundred percent and I don't have a single error now. Oh my days! There is a god!
Most helpful comment
I did this in pycharm and it did work:
pip install Django --upgrade
Then
python manage.py migrate
python manage.py makemigrations 'app_name'
python manage.py migrate