Peewee was unable to import any of the known database drivers. Try running this from your interactive shell:
import sqlite3
import psycopg2
import MySQLdb
If they all fail with an import error, then that would explain your issue.
Вопрос
I'm trying to run my application with peewee on a server and it keeps crashing.
To start the application the start function is called in main.py:
def start(db_name, db_user, db_pass):
BaseModel.initialize_database(db_name, db_user, db_pass)
classA.create_table()
classB.create_table()
return app
It crashes on the first line in the BaseModel class.
from peewee import MySQLDatabase
from peewee import Model
I get the following error: "ImproperlyConfigured: Either sqlite3, psycopg2 or MySQLdb must be installed".
I don't understand the error because the database is running on the same server. The database was created using phpmyadmin.
When I test the application on my laptop everything works fine, for testing I use an SQLite database "test.db".
Решение
Peewee was unable to import any of the known database drivers. Try running this from your interactive shell:
import sqlite3
import psycopg2
import MySQLdb
If they all fail with an import error, then that would explain your issue.
Другие советы
In Pycharm: