Skip to content

Instantly share code, notes, and snippets.

@bradenmacdonald
Created October 27, 2011 18:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradenmacdonald/1320318 to your computer and use it in GitHub Desktop.
Save bradenmacdonald/1320318 to your computer and use it in GitHub Desktop.
Django-CMS Wymeditor cross-domain issue workaround
# Set up your site so that static files can be accessed from the static
# domain *or* from a subfolder of the main site (e.g. use a symlink)
# Then add a setting like the following to your site's settings.py,
# such that /static/ is the same as http://static.yourdomain.com
#############################################################################
WYM_CMS_STATIC_URL = '/static/cms/'
#############################################################################
# Replace the last line of cms/plugins/text/settings.py with the following:
#############################################################################
# The CMS Static URL to be used as the base for WYM include URLs
WYM_CMS_STATIC_URL = getattr(settings, "WYM_CMS_STATIC_URL", cms_static_url(''))
#Advantageously replaces WYM_CLASSES and WYM_STYLES
##Prepare url for wymeditor.css
WYM_STYLESHEET = getattr(settings, "WYM_STYLESHEET", '"%scss/wymeditor.css"' % WYM_CMS_STATIC_URL)
#############################################################################
# Make the following change to skinPath and add the following basePath
# setting to cms/plugins/text/templates/cms/plugins/widgets/wymeditor.html:
#############################################################################
// init wysiwyg
$('#id_{{ name }}').wymeditor({
lang: '{{ language }}',
skin: 'django',
skinPath: "{{ WYM_CMS_STATIC_URL }}js/wymeditor/skins/django/",
updateSelector: 'input[type=submit],',
updateEvent: 'click',
basePath: '{{ WYM_CMS_STATIC_URL }}wymeditor/',
#############################################################################
# Finally, in cms/plugins/text/widgets/wymeditor_widget.py, add the following
# new line to the `context` section near the end of the file:
#############################################################################
'WYM_STYLESHEET': mark_safe(text_settings.WYM_STYLESHEET),
'WYM_CMS_STATIC_URL': mark_safe(text_settings.WYM_CMS_STATIC_URL),
'installed_plugins': self.installed_plugins,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment