Dajaxice 0.5.4.1を使用している Python 2.7 で実行されている Django 1.4 プロジェクトがあります。開発マシン (Windows 7) にセットアップしましたが、すべてが完全に機能します。ただし、アプリを運用サーバー (Ubuntu 12.04) にデプロイするdajaxice.core.js
と、ファイルに対して 404 エラーが発生し、何があってもこの問題を解決できません。本番サーバーは、すべてのソフトウェアのまったく同じバージョンで動作します。
私のプロジェクト構造は次のようになります。
/myproject
/myproject/myproject-static/ <-- all the static files are here
/myproject/myproject-static/css/
/myproject/myproject-static/img/
/myproject/myproject-static/js/
/myproject/templates/
/myproject/myproject/
/myproject/main/
/myproject/app1/
/myproject/app2/
/myproject/app3/
etc.
ここでDajaxice のインストール手順に従って、すべてを所定の場所に配置しました ( settings.py
.˙urls.py and
base.html` ファイル内)。
私のsettings.py
ファイルには次の値もあります。
from unipath import Path
PROJECT_ROOT = Path(__file__).ancestor(3)
STATIC_ROOT = ''
STATIC_URL = '/myproject-static/'
STATICFILES_DIRS = (
PROJECT_ROOT.child('myproject-static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'dajaxice.finders.DajaxiceFinder',
)
DAJAXICE_MEDIA_PREFIX = "dajaxice"
DAJAXICE_DEBUG = True
ファイルに次のようなディレクティブAlias
があります。django.conf
Alias /myproject-static/ "/path/to/myproject/myproject-static/"
私はcollectstatic
実稼働サーバーで行い、プロジェクトのルートにあるいくつかのフォルダー内にすべての静的ファイルを収集しました。そのため、デプロイした Web サイトを見ると、CSS が適切に適用され、JavaScript が正常に機能し、サイト内のナビゲーションが意図したとおりに機能していることがわかります。含まれていないため、Ajaxが完全に壊れていることを除いて、すべて問題dajaxice.core.js
ありません。
静的を収集した後の私のプロジェクト フォルダー構造は次のようになります。
/myproject
/myproject/myproject-static/ <-- all the static files are originally here
/myproject/myproject-static/css/
/myproject/myproject-static/img/
/myproject/myproject-static/js/
/myproject/templates/
/myproject/admin/ <-- folder created with 'collectstatic' command
/myproject/css/ <-- folder created with 'collectstatic' command
/myproject/dajaxice/ <-- dajaxice.core.js is located here
/myproject/django_extensions/ <-- folder created with 'collectstatic' command
/myproject/img/ <-- folder created with 'collectstatic' command
/myproject/js/ <-- folder created with 'collectstatic' command
/myproject/myproject/
/myproject/main/
/myproject/app1/
/myproject/app2/
/myproject/app3/
etc.
ここで静的ファイルに何か完全に問題がありますか?
この単純なエラーを修正するには、他に何を試みるべきですか?