我为我的项目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 /没有加载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}),
)
任何人都可以帮助我吗?