kopia lustrzana https://github.com/wagtail/wagtail
Update docs to use new STORAGES setting
rodzic
33df113bf4
commit
3a3d056793
|
|
@ -22,7 +22,7 @@ As with all Django projects, static files are only served by the Django applicat
|
|||
See [Django's documentation on deploying static files](inv:django#howto/static-files/deployment).
|
||||
|
||||
The JavaScript and CSS files used by the Wagtail admin frequently change between releases of Wagtail - it's important to avoid serving outdated versions of these files due to browser or server-side caching, as this can cause hard-to-diagnose issues.
|
||||
We recommend enabling [ManifestStaticFilesStorage](django.contrib.staticfiles.storage.ManifestStaticFilesStorage) in the `STATICFILES_STORAGE` setting - this ensures that different versions of files are assigned distinct URLs.
|
||||
We recommend enabling [ManifestStaticFilesStorage](django.contrib.staticfiles.storage.ManifestStaticFilesStorage) in the `STORAGES["staticfiles"]` setting - this ensures that different versions of files are assigned distinct URLs.
|
||||
|
||||
(user_uploaded_files)=
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ We recommend enabling [ManifestStaticFilesStorage](django.contrib.staticfiles.st
|
|||
Wagtail follows [Django's conventions for managing uploaded files](inv:django#topics/files).
|
||||
So by default, Wagtail uses Django's built-in `FileSystemStorage` class which stores files on your site's server, in the directory specified by the `MEDIA_ROOT` setting.
|
||||
Alternatively, Wagtail can be configured to store uploaded images and documents on a cloud storage service such as Amazon S3;
|
||||
this is done through the [DEFAULT_FILE_STORAGE](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_FILE_STORAGE)
|
||||
this is done through the [`STORAGES["default"]`](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-STORAGES)
|
||||
setting in conjunction with an add-on package such as [django-storages](https://django-storages.readthedocs.io/).
|
||||
|
||||
When using `FileSystemStorage`, image urls are constructed starting from the path specified by the `MEDIA_URL`.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Wagtail follows [Django’s conventions for managing uploaded files](inv:django#
|
|||
|
||||
## File storage location
|
||||
|
||||
Wagtail uses the [DEFAULT_FILE_STORAGE](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_FILE_STORAGE) setting to determine where and how user-uploaded files are stored. By default, Wagtail stores files in the local filesystem.
|
||||
Wagtail uses the [`STORAGES["default"]`](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-STORAGES) setting to determine where and how user-uploaded files are stored. By default, Wagtail stores files in the local filesystem.
|
||||
|
||||
## Serving documents
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ To upgrade:
|
|||
- Make any necessary code changes as directed in the "Upgrade considerations" section of the release notes.
|
||||
- Test that your project is working as expected.
|
||||
|
||||
Remember that the JavaScript and CSS files used in the Wagtail admin may have changed between releases - if you encounter erratic behaviour on upgrading, ensure that you have cleared your browser cache. When deploying the upgrade to a production server, be sure to run `./manage.py collectstatic` to make the updated static files available to the web server. In production, we recommend enabling [ManifestStaticFilesStorage](https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#manifeststaticfilesstorage) in the `STATICFILES_STORAGE` setting - this ensures that different versions of files are assigned distinct URLs.
|
||||
Remember that the JavaScript and CSS files used in the Wagtail admin may have changed between releases - if you encounter erratic behaviour on upgrading, ensure that you have cleared your browser cache. When deploying the upgrade to a production server, be sure to run `./manage.py collectstatic` to make the updated static files available to the web server. In production, we recommend enabling [ManifestStaticFilesStorage](https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#manifeststaticfilesstorage) in the `STORAGES["staticfiles"]` setting - this ensures that different versions of files are assigned distinct URLs.
|
||||
|
||||
(compatible_django_python_versions)=
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ CSRF_TRUSTED_ORIGINS = os.getenv("DJANGO_CSRF_TRUSTED_ORIGINS", "").split(",")
|
|||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
MIDDLEWARE.append("whitenoise.middleware.WhiteNoiseMiddleware")
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
STORAGES["staticfiles"]["BACKEND"] = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
if "AWS_STORAGE_BUCKET_NAME" in os.environ:
|
||||
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME")
|
||||
|
|
@ -367,7 +367,7 @@ if "AWS_STORAGE_BUCKET_NAME" in os.environ:
|
|||
|
||||
INSTALLED_APPS.append("storages")
|
||||
|
||||
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
STORAGES["default"]["BACKEND"] = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
|
||||
AWS_S3_OBJECT_PARAMETERS = {
|
||||
'CacheControl': 'max-age=86400',
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue