1

我为我的项目 muvidb_backup 做了一个构建。

在 bin 文件夹中有 django.wsgi 文件

这个文件看起来像:

import sys
sys.path[0:0] = [
  '/home/abhilash/Documents/muvidb_backup/eggs/ipython-0.13.1-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/django_grappelli-2.4.3-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/django_markitup-0.5.2-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/django_robots-0.7.0-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/django_filebrowser-3.5.1-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/BeautifulSoup-3.2.0-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/Markdown-2.2.1-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/djangorecipe-1.3-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/Django-1.4-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/zc.recipe.egg-1.3.2-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/zc.buildout-1.6.3-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup/eggs/setuptools-0.6c12dev_r88846-py2.7.egg',
    '/home/abhilash/Documents/muvidb_backup',
  ]

import djangorecipe.wsgi

application = djangorecipe.wsgi.main('muvidb_backup.development', logfile='')

我的 Apache 配置文件是:

<VirtualHost *:8080>
DocumentRoot "/home/abhilash/Documents/muvidb_backup"
<Directory "/home/abhilash/Documents/muvidb_backup">
    allow from all

    Options +Indexes
</Directory>

Alias /static/admin/ "/home/abhilash/Documents/muvidb_backup/muvidb_backup/static/admin"


WSGIScriptAlias / /home/abhilash/Documents/muvidb_backup/bin/django.wsgi
</VirtualHost>

我的 Seetings.py 文件

STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static')


STATIC_URL = '/static/'


ADMIN_MEDIA_PREFIX = '/static/admin/'

为什么 Localhost:8080/admin/ 没有加载管理 css 和 js 文件?

在静态文件夹中,我有 admin/css 和 js 文件夹。

更多在 url.py 我有一个快速代码来获取静态文件

if settings.DEBUG:
    urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
     {'document_root': settings.MEDIA_ROOT}),
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
     {'document_root': settings.STATIC_ROOT}),
)   

谁能帮我 ???

4

0 回答 0