danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
594 stars 158 forks source link

Disable "~" #235

Closed jgourmelen closed 5 months ago

jgourmelen commented 3 years ago

I use Scaleway with django-storage for staticfiles. But scaleway don't accept "~" character in the name of the files :

/usr/src/app $ python manage.py collectstatic -v3 Copying '/usr/local/lib/python3.8/site-packages/django_comments_xtd/static/django_comments_xtd/js/vendor~plugin-3.0.0.js.map' Traceback (most recent call last): File "manage.py", line 22, in main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(args, options) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 194, in handle collected = self.collect() File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 118, in collect handler(path, prefixed_path, storage) File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 355, in copy_file self.storage.save(prefixed_path, source_file) File "/usr/local/lib/python3.8/site-packages/django/core/files/storage.py", line 52, in save return self._save(name, content) File "/usr/local/lib/python3.8/site-packages/storages/backends/s3boto3.py", line 451, in _save obj.upload_fileobj(content, ExtraArgs=params) File "/usr/local/lib/python3.8/site-packages/boto3/s3/inject.py", line 619, in object_upload_fileobj return self.meta.client.upload_fileobj( File "/usr/local/lib/python3.8/site-packages/boto3/s3/inject.py", line 539, in upload_fileobj return future.result() File "/usr/local/lib/python3.8/site-packages/s3transfer/futures.py", line 106, in result return self._coordinator.result() File "/usr/local/lib/python3.8/site-packages/s3transfer/futures.py", line 265, in result raise self._exception File "/usr/local/lib/python3.8/site-packages/s3transfer/tasks.py", line 126, in call return self._execute_main(kwargs) File "/usr/local/lib/python3.8/site-packages/s3transfer/tasks.py", line 150, in _execute_main return_value = self._main(kwargs) File "/usr/local/lib/python3.8/site-packages/s3transfer/upload.py", line 692, in _main client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args) File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 676, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your key and signing method. /usr/src/app $

Is it possible to use an other pattern for the naming of this files : "vendor~plugin-3.0.0.js.map"

Thanks :)

danirus commented 3 years ago

Yes, you can customize it in the webpack.config.js file in the root directory. Edit it and add the automaticNameDelimiter entry to the splitChunks attribute (after line 20). If you wanted a simple hyphen you would have this:

    splitChunks: {
      automaticNameDelimiter: '-',
        cacheGroups: {
           ...

After that run the command webpack -p and you will get the files in the django_comments_xtd/static/django_comments_xtd/js/ directory.

jgourmelen commented 3 years ago

It's OK ;), thanks a lot !