mardi 27 janvier 2015

My SQLite database is not recognized : "no such table myapp_onemodel"

I have set up a Django website (1.7.3) with Python 3 on my VPS (Ubuntu12.04, Apache2.2) with mod_wsgi. I have this following error when trying to get on mywebsite page that involves the database :



OperationalError at /myapp/
no such table: myapp_category
Request Method:GET
Request URL: http://ift.tt/1JUFlS3
Django Version: 1.7
Exception Type: OperationalError
Exception Value: no such table: myapp_category
Exception Location: /opt/.virtualenvs/mysite_env/lib/python3.2/site-packages/django/db/backends/sqlite3/base.py in execute, line 485
Python Executable: /usr/bin/python
Python Version:3.2.3
Python Path: ['/opt/.virtualenvs/mysite_env/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg',
'/opt/.virtualenvs/mysite_env/lib/python3.2/site-packages/pip-1.1-py3.2.egg',
'/var/www/velo173py3',
'/opt/.virtualenvs/mysite_env/lib/python3.2/site-packages',
'/usr/lib/python3.2',
'/usr/lib/python3.2/plat-linux2',
'/usr/lib/python3.2/lib-dynload',
'/usr/local/lib/python3.2/dist-packages',
'/usr/lib/python3/dist-packages']


My settings.py on my server regarding the database is the following :



import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

DATABASES = {
'default':{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase',
}
}



  1. I ran python manage.py makemigrations myapp (I have only one app in my website) and python manage.py migrate successfully. (I also remove migrations/ folder and mydatabase file and began anew to two first commands to run the migrations, also successfully).

  2. I checked the 'mydatabase' file exists.

  3. I put the right permissions on mydatabase file. But the error stays the same, as if the database does not exist.


Any help would be greatly appreciated!


Aucun commentaire:

Enregistrer un commentaire