pip install django-compressor python INSTALLED_APPS = [ ... 'compressor', ... ] python STATICFILES_FINDERS = [ 'compressor.finders.CompressorFinder', ] python CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', } } python COMPRESS_CACHE_BACKEND = 'default' python COMPRESS_VERSION = True html {% load compress %} {% compress css %} <link rel="stylesheet" href="{% static 'css/main.css' %}"> <link rel="stylesheet" href="{% static 'css/custom.css' %}"> {% endcompress %} {% compress js %} <script src="{% static 'js/main.js' %}"></script> <script src="{% static 'js/custom.js' %}"></script> {% endcompress %} python manage.py collectstatic


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