I made an app in flask that uses an sqlite3 database. The app works flawlessly when I run it using Flask's internal testing server. However, when I attempt to deploy my app, either using apache2 or gunicorn+nginx, and the logs of whatever server I'm using shows "OperationalError: unable to open database file".

Here is the full file that's causing the error:

import sqlite3 __all__ = ['Database'] class Database(object): def __init__(self, name): self._name = name def _execute(self, command, args=None): connection = sqlite3.connect(self._name) cursor = connection.cursor() if args is None: out = cursor.execute(command).fetchall() else: out = cursor.execute(command, args).fetchall() connection.commit() connection.close() return out

The connection = sqlite3.connect(self._name) is the line that is actually triggering the error and I have no clue why. I have tried replacing self._name with a hard coded string to the path of the database to no avail. I have also made sure the database file has proper read write permissions.

Does anyone know how I can figure out what's going on?