0

I have sqlite database setting like in my production server :

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}

}

I have also tried chown www-data path_to_db and chmod 777 path_to_db

I am using celery, rabbitmq and supervisor in this application.. but its still showing error saying unable to open database.. whats the issue here

5
  • 2
    Why aren't you using a proper database server in production? Commented Jul 25, 2015 at 18:03
  • @DanielRoseman Its a very small website so I used sqlite.. What might be the issue here ? Commented Jul 25, 2015 at 18:11
  • Are you sure, that DATABASES.default.NAME points to the correct location? How are you deploying your project? Commented Jul 25, 2015 at 18:17
  • I have did syncdb and created superuser too.. When I tried to login admin it said unable to write readonly database but after doing chown www-data path_to_db it gives unable to oepen database file error Commented Jul 25, 2015 at 18:22
  • @DanielRoseman I am also using celery, rabbitmq and supervisor .. but I am using all this in my local too and it worked fine with sqlite Commented Jul 25, 2015 at 18:23

2 Answers 2

3

This worked for me:

chown www-data path_to_directory_containing_db
Sign up to request clarification or add additional context in comments.

Comments

0

First lets find out the value of BASE_DIR. Add to your settings.py

print "base dir %s" % BASE_DIR

And run server. You'll see your base_dir and could ensure that file is in right place.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.