Search code examples
pythonsqliteflaskweb-hostinguwsgi

After modifying the schema Flask with wsgi tells me there is no such column, but it's there


I followed the Flask tutorial (https://flask.palletsprojects.com/en/3.0.x/tutorial/) and created a Flask app with factory and a SQLite database. I run the app on a server via uwsgi and added github actions for CI/CD.

I modified the schema.sql, reinitialized my SQLite database and reinstalled the app. Now I can still run it on production server, but when I start it with uwsgi, I get sqlite3.OperationalError: column not found (one of the columns that have I changed/added). When I check my SQLite file, the column is there.

Any Ideas?


Solution

  • The problem was the instance_path from Flask.

    My database is located in /home/username/appname/instance/, but the instance_path, where Flask was looking for the database was: /home/username/.local/var/appname-instance/

    When I set the instance_path explicitly in create_app() it works.