简体   繁体   中英

ImportError: No module named _sqlite3 after deploying Flask app to gcloud

I'm deployed an app to Google Cloud using this tutorial. The app is made using Flask and makes use of flask-sqlalchemy (and thus sqlalchemy).

I can load pages that don't make use of sqlalchemy fine, but pages that do raise a 500 error. The error page shows ImportError: No module named _sqlite3 .

I suspect it has something to do with me trying to install a Python3 library to gcloud's Python2.7 environment, but I don't know how to fix this. Who can help me?

Have a look at Google's examples here for App Engine Standard, Cloud SQL and Python: https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/cloud-sql

There's one for MySQL and another for PostgreSQL.

The tutorial link you shared does not appear to include a database component so I'm assuming you've evolved the example and that you're planning to use Google Cloud SQL database service for your backend.

You're likely missing a Python package that provides SQL connectivity (Google uses PyMySQL )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM