2012-01-05 11 views
2

組み込みサーバーでうまく動作するdjangoプロジェクトがありますが、Apache/mod_wsgiで使用すると、管理ページの静的ファイル(/ static/admin/css )が見つからない(404)。ここに私の設定です:Django adminの静的ファイルのみ - > 404

MEDIA_ROOT = '' 
MEDIA_URL = '' 
STATIC_ROOT = '/var/www/wsgi/myproject/static' 
STATIC_URL = '/static/' 
ADMIN_MEDIA_PREFIX = '/static/admin/' 

STATICFILES_DIRS =() 

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
    ) 


TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader', 
    'django.template.loaders.app_directories.Loader', 
    ) 

TEMPLATE_CONTEXT_PROCESSORS = (
    "socialauth.context_processors.facebook_api_key", 
    'django.core.context_processors.media', 
    "django.contrib.auth.context_processors.auth", 
    "django.core.context_processors.request", 
    "django.core.context_processors.static", 
    ) 

ROOT_URLCONF = 'myproject.urls' 

TEMPLATE_DIRS = ('/var/www/wsgi/myproject/templates',) 

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.admin', 
    'myproject.myapp', 
    ) 

私も

sudo python ./manage.py collectstatic 

を実行しようとしたが、運を持ちます。

答えて

1

Apache仮想ホストの設定はどのようになっていますか? STATIC_ROOTパスにはAliasディレクティブを含める必要があります。これらの線に沿って

何か:

Alias /static [project-path]/static 
Alias /media [project-path]/media 
<Directory [project-path]/static> 
    Order deny,allow 
    Allow from all 
</Directory> 
<Directory [project-path]/media> 
    Order deny,allow 
    Allow from all 
</Directory> 

あなたが書かれてきたように、あなたは生産の新しい静的ファイルを展開する./manage collectstaticたびに実行する必要があります。

関連する問題