Friday, 15 May 2015

python - OperationalError: unable to open database file -



python - OperationalError: unable to open database file -

graphite throwing unable open database file

tail -f /etc/httpd/logs/error_log

this setting.py file configuration

databases = { 'default': { 'name': '/opt/graphite/webapp/test.db', 'engine': 'django.db.backends.sqlite3', 'user': '', 'password': '', 'host': '', 'port': '' } }

done

python manage.py syncdb

the file exists in below location

[root@bash graphite]# ls -l /opt/graphite/webapp/test.db -rw-rw-rw- 1 nobody nobody 65536 nov 11 22:22 /opt/graphite/webapp/test.db

it throws below error

[tue nov 11 22:24:15 2014] [error] file "/usr/lib/python2.6/site-packages/django/db/backends/util.py", line 53, in execute [tue nov 11 22:24:15 2014] [error] homecoming self.cursor.execute(sql, params) [tue nov 11 22:24:15 2014] [error] file "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 452, in execute [tue nov 11 22:24:15 2014] [error] homecoming database.cursor.execute(self, query, params) [tue nov 11 22:24:15 2014] [error] operationalerror: unable open database file

check rights of user, whom executing python manage.py syncdb.

this user must have rights read , write file /opt/graphite/webapp/test.db

and read, write , execute rights folder /opt/graphite/webapp/

try commands (execute user, starts python manage.py syncdb, current user)

sudo chown `whoami`:`whoami` /opt/graphite/webapp/test.db # alter owner sudo chmod o+rw /opt/graphite/webapp/test.db # add together rights sudo chown `whoami`:`whoami` /opt/graphite/webapp/ sudo chmod o+rwx /opt/graphite/webapp/

python django sqlite graphite

No comments:

Post a Comment