1

Django REST API フレームワークのこのチュートリアルを実行しようとしています。

Apache セットアップを使用してテストすると、ページを参照しようとすると次のエラーが表示されます。

TemplateDoesNotExist at /
rest_framework/api.html

ただし、Python テスト Web サーバーを実行してテストすると、python ./manage.py runserver問題なく動作します。

これを修正するために Apache で行う必要のある構成変更はありますか?

前もって感謝します。

編集

ファイルの場所が間違っていることに気付きました。

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-
packages/django/contrib/auth/templates/rest_framework/api.html (File does not exist)

ただし、これを変更する場所が見つかりません。

4

1 に答える 1

2

仮想環境を作成し、それに応じて Apache を構成することで、この問題を解決しました。

WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python2.X/site-packages
于 2013-11-05T12:34:55.260 に答える