pip install django-compressor python INSTALLED_APPS = ( ... 'compressor', ... ) python manage.py collectstatic python STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') python COMPRESS_ENABLED = True COMPRESS_PRECOMPILERS = ( ) python urlpatterns += [ url(r'^', include('compressor.urls')), ] html {% load compress %} html {% compress css %} <link rel="stylesheet" type="text/css" href="{% static 'css/style1.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'css/style2.css' %}" /> {% endcompress %}


上一篇:
下一篇:
切换中文