Set a static file on django

    1. In setting file:
        ROOT_PATH='/home/ronglian/project/taskschedule'
        STATIC_URL = '/static/'
        STATICFILES_DIRS=(
            # Put strings here, like "/home/html/static" or "C:/www/django/static".
            # Always use forward slashes, even on Windows.
            os.path.join(ROOT_PATH,'static'),
        )
        STATIC_ROOT= ''
    2. In above of urls.py file :
    
     from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    3. Add urlpatterns in urls.py file:
    urlpatterns +=staticfiles_urlpatterns()

    4. In the project directory, make a new directory file named 'static', the add the css and jquery file in it.

 

posted @ 2015-08-24 22:58  自由清风  阅读(222)  评论(0编辑  收藏  举报