You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using django-dbtemplates with codemirror enabled inside my admin site. The problem is that the url it's trying to fetch codemirror.js from is incorrect. It tries to get http://<s3 endpoint>/dbtemplates/js/codemirror.js, which doesn't work (of course).
I found that I'm able to modify the place it's looking with DBTEMPLATES_MEDIA_PREFIX. Setting that to any value will result in a URL that's somewhat more correct (e.g. http://<s3 endpoint>/<bucket>/static/<media prefix value>/js/codemirror.js. Setting the variable to dbtemplates/ makes codemirror.js load. The real problem is that codemirror loads submodules itself. By default, it tries to load them at the current path (e.g. /admin/dbtemplates/template/add/undo.js). I fixed the submodule loading by setting DBTEMPLATES_MEDIA_PREFIX to /dbtemplates/. This unfortunately causes the codemirror.js file itself to fail.
I think the usage of DBTEMPLATES_MEDIA_PREFIX should be split up into 2 different variables: one that makes codemirror.js load, and one that is passed as a path to the codemirror instance in javascript (dbtemplates/admin.py:51). It should at least not have the exact same value.
The text was updated successfully, but these errors were encountered:
I'm using django-dbtemplates with codemirror enabled inside my admin site. The problem is that the url it's trying to fetch codemirror.js from is incorrect. It tries to get
http://<s3 endpoint>/dbtemplates/js/codemirror.js
, which doesn't work (of course).I found that I'm able to modify the place it's looking with
DBTEMPLATES_MEDIA_PREFIX
. Setting that to any value will result in a URL that's somewhat more correct (e.g.http://<s3 endpoint>/<bucket>/static/<media prefix value>/js/codemirror.js
. Setting the variable todbtemplates/
makescodemirror.js
load. The real problem is that codemirror loads submodules itself. By default, it tries to load them at the current path (e.g./admin/dbtemplates/template/add/undo.js
). I fixed the submodule loading by settingDBTEMPLATES_MEDIA_PREFIX
to/dbtemplates/
. This unfortunately causes the codemirror.js file itself to fail.I think the usage of
DBTEMPLATES_MEDIA_PREFIX
should be split up into 2 different variables: one that makes codemirror.js load, and one that is passed as a path to the codemirror instance in javascript (dbtemplates/admin.py:51
). It should at least not have the exact same value.The text was updated successfully, but these errors were encountered: