4

ピラミッドで sqlalchemy プロジェクトを作成しようとしましたが、サーバーを実行すると、次のエラーが発生します。

Pyramid is having a problem using your SQL database.  The problem
might be caused by one of the following things:

1.  You may need to run the "initialize_MyProject_db" script
    to initialize your database tables.  Check your virtual 
    environment's "bin" directory for this script and try to run it.

2.  Your database server may not be running.  Check that the
    database server referred to by the "sqlalchemy.url" setting in
    your "development.ini" file is running.

After you fix the problem, please restart the Pyramid application to
try it again.

development.ini ファイルを確認すると、sqlite データベースは次のように構成されています。

sqlalchemy.url = sqlite:///%(here)s/MyProject.sqlite

正しく構成するには、ここで何を変更する必要がありますか?

Linuxボックスで実行します。

4

3 に答える 3

2

sqlite、postgres、またはその他のいずれかでデータベースを作成する必要があります。その後、development.iniファイル編集に移動しsqlalchemy.url = sqlite:///%(here)s/MyProject.sqliteてデータベースの名前を指定し、コマンドを実行しinitialize_myproject_db development.iniます。mysql を使用している場合、その行は sqlachemy.uri = mysql である必要があります。 //username:password@host/dbname

于 2014-08-15T13:33:18.247 に答える
2

初めて Pyramid を試してみたところ、同じ問題に直面しました。多くのコマンドの組み合わせの後、解決策が得られました。

プロジェクト ルートから次のコマンドを実行します。

initialize_tutorial_db development.ini

Wiki2 SQLAlchemy チュートリアルから取得した情報

于 2014-09-08T14:18:28.650 に答える