Uploading images with TinyMCE
I'm trying to install TinyMCE to my django project for blog posts, I have the initial content block working but It isn't allowing me to upload images with the following errors:
Forbidden (CSRF token missing.): /admin/mhpapp/testmodel/add/static/images/images
I have the app added in my settings.py
Settings.py:
urlpatterns = [
path('tinymce/', include('tinymce.urls')),
TINYMCE_DEFAULT_CONFIG = {
"height": "320px",
"width": "960px",
"menubar": "file edit view insert format tools table help",
"plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code "
"fullscreen insertdatetime media table paste code help wordcount spellchecker",
"toolbar": "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft "
"aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor "
"backcolor casechange permanentpen formatpainter removeformat | pagebreak | charmap emoticons | "
"fullscreen preview save print | insertfile image media pageembed template link anchor codesample | "
"a11ycheck ltr rtl | showcomments addcomment code",
"custom_undo_redo_levels": 10,
"images_upload_url": 'static/images/images',
"images_upload_handler": "tinymce_image_upload_handler"
}
TINYMCE_EXTRA_MEDIA = {
'css': {
'all': [
],
},
'js': [
"https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js",
"admin/js/tinymce-upload.js",
],
}
I am currently testing on local server but would also like this to work on my production server that I have hosted on my own ubuntu VPS usinh nginx
Any help would be greatly appreciated.