靜態資源處理



STATIC_ROOT = 'static'
STATIC_URL = '/static/'



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



    <script src="./static/app/js/jquery-1.10.2.js"></script>
    <script src="./static/app/js/my.js"></script>



STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    # os.path.join(os.path.dirname(__file__), '..', 'static').replace('\\','/'),
    'app/static',
)


Tools -Run manage.py Task-collectstatic

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章