3

The website on Django 1.10. Can't understand the work TinyMCE. The site statics are located on AWS S3.

settings.py

AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = 'orpro-assets'                                
AWS_S3_CUSTOM_DOMAIN = 
'{}.s3.amazonaws.com'.format(AWS_STORAGE_BUCKET_NAME)
AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400',}
REGION_NAME = 'us-east-1'
AWS_LOCATION = 'static'
AWS_MEDIA = 'media'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
STATIC_URL = "https://{}/{}/".format(AWS_S3_CUSTOM_DOMAIN, 
AWS_LOCATION)
AWS_PUBLIC_MEDIA_LOCATION = 'media'
MEDIA_URL = "https://{}/{}/".format(AWS_S3_CUSTOM_DOMAIN, AWS_MEDIA)
DEFAULT_FILE_STORAGE = 'app.storage_backends.MediaStorage'

TINYMCE_DEFAULT_CONFIG = {
    'theme': "lightgray",
    'relative_urls': False}
TINYMCE_JS_ROOT = STATIC_URL + 'tiny_mce'
TINYMCE_JS_URL = STATIC_URL + 'tiny_mce/tiny_mce.js'
TINYMCE_INCLUDE_JQUERY = False

storage_backends.py

from storages.backends.s3boto3 import S3Boto3Storage

class MediaStorage(S3Boto3Storage):
    location = 'media'
    file_overwrite = False

When you load the home page, at the end of the load appears scripts that link to the folder static site. There are no such scripts in the templates. But the addition of the block is enabled: {% block additional_scripts %} {% endblock %}

All other static files are loaded correctly with amazon-s3

Update The site is launched in the mode DEBUG = False

1 Answers1

0

Make sure that you have 'tinymce' in your INSTALLED_APPS in your settings file.

Once this is done, run python manage.py collectstatic

Animesh Sharma
  • 3,258
  • 1
  • 17
  • 33