question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source map line in jsoneditor.min.js makes collectstatic fail

See original GitHub issue
  • django-json-widget version: 1.1.1
  • Django version: 4.0
  • Python version: 3.8.10
  • Operating System: linux ubuntu (in docker)

Description

When running python manage.py collectstatic with whitenoise 5.3.0, I get the following error:

es/management/commands/collectstatic.py", line 134, in collect
remote:            raise processed
remote:        whitenoise.storage.MissingFileError: The file 'dist/jsoneditor.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7f260dc431f0>.
remote:        The JS file 'dist/jsoneditor.min.js' references a file which could not be found:
remote:          dist/jsoneditor.map

it seems it’s because of the source map bit. When we removed the last line https://github.com/jmrivas86/django-json-widget/blob/master/django_json_widget/static/dist/jsoneditor.min.js#L46 , it works.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:11
  • Comments:9

github_iconTop GitHub Comments

2reactions
dmwyattcommented, Nov 6, 2022

I actually found a way to deal with this issue, if anyone ever comes here again. He asks for a file which he does not use, so I decided to just put the file where he expects it and it worked like a charm. I am building my project with a Dockerfile, so I just added there

COPY random/jsoneditor.map /usr/local/lib/python3.9/site-packages/django_json_widget/static/dist

the file may be empty. It is not the prettiest solution, but it does work. Hope it helps someone else.

It’s so terrible, I love it.

Here’s a one-liner to do the same thing.

python -c "import django_json_widget as _; from pathlib import Path; p=Path(_.__path__[0]) / 'static' / 'dist' / 'jsoneditor.map'; p.touch()"

This accounts for different package installation paths and whatnot…I use it in CI/CD environment.

Really someone needs to submit a PR to fix this. However, @jmrivas86 hasn’t been active on GH in many months and his website doesn’t work, so not sure if we can expect a PR to get merged. Failing that someone will have to fork…

2reactions
FroguelObramaxcommented, Sep 1, 2022

I actually found a way to deal with this issue, if anyone ever comes here again. He asks for a file which he does not use, so I decided to just put the file where he expects it and it worked like a charm. I am building my project with a Dockerfile, so I just added there

COPY random/jsoneditor.map /usr/local/lib/python3.9/site-packages/django_json_widget/static/dist

the file may be empty. It is not the prettiest solution, but it does work. Hope it helps someone else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't collect static files if don't have vendor's JavaScript ...
Even if you left the source map line in, the browser devtools will request it and hit a 404, and show you an...
Read more >
Unable to run collectstatic , "references a file which could not ...
js is in virtualenv. The problem is the cloudinary package apparently doesn't ship the .map file cloudinary\static\js\load-image.all.min.
Read more >
django-json-widget 1.1.1 - PythonFix.com
Django json widget is an alternative widget that makes it easy to edit the jsonfield field ... Source map line in jsoneditor.min.js makes...
Read more >
How to Set Up Source Maps with Django - Adam Johnson
Source maps are files that map your minified CSS or JavaScript back to the original code. They allow you to use your browser's...
Read more >
Simple index - piwheels
... py-pdf-collate make-subtitle django-simple-markdown kubes ncbidare stargen xendit moneyflowindicator life-line-chart aliyun-python-sdk-schedulerx2 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found