'QuillField not showing in django admin
Quill editor v0.1.40 works fine on my local computer, but when in production, QuillFileds are invisible on admin panel – only labels appear:
When inspecting the admin page on Chrome, I see such errors on the console:
GET https://my site.com/static/django_quill/django_quill.css net::ERR_ABORTED 404 (Not Found)
GET https://my site.com/static/django_quill/django_quill.js net::ERR_ABORTED 404 (Not Found)
Uncaught ReferenceError: QuillWrapper is not defined
at (index):261:27
at (index):263:11
django_quill.css and django_quill.js fail to load. I can't figure out why it works on my local project which has the same setup, except that on local I use python 3.9/Django 4.0.1 while in production, it's v3.8/4.0.2.
Another difference is that, in production, django_quill folder is under myenv/lib/python3.8/site-packages/ directory.
On my computer, there is no django_quill folder under myenv/lib/python3.9/site-packages/. In fact, there is no such folder anywhere on my drive, nor the related django_quill.css or django_quill.js files.
I have no problem while migrating from old TextField's, or viewing the content on the templates.
Any suggestion or feedback will be welcomed and greatly appreciated.
Thank you.
Solution 1:[1]
On my development settings, static configuration was as follows:
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static']
Whereas on production:
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static']
STATIC_ROOT = BASE_DIR / 'static/root'
Which was a mistake, of course. STATICFILES_DIRS shouldn't be present on production. So I changed it to:
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static/'
and ran collectstatic. Now it works fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | steerr |

