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.
原文地址:https://www.cnblogs.com/allenz/p/4756189.html