0

I am using django-summernote as a wysiwyg editor. The editor works fine in my development stage. Where my Django setting is using the below code

STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

However the moment I switch to production where my static files are saved on AWS. I do not see the summernote wysiwyg editor. Infact the the entire text-field disappears. Also My static files are working perfectly with everything else. My style.css file on my aws is the exactly the same as my dev stage below are are my AWS settings

AWS_DEFAULT_ACL = None
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
DEFAULT_FILE_STORAGE = 'aws_storage_classes.MediaStorage'
AWS_STORAGE_BUCKET_NAME = 'cool-media-8axodgh6d'
STATICFILES_STORAGE = 'aws_storage_classes.StaticStorage'
AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400',
}

AWS_S3_DOMAIN = "%s.s3.amazonaws.com" % AWS_STORAGE_BUCKET_NAME

STATIC_URL = 'https://%s/static/' % AWS_S3_DOMAIN
MEDIA_URL = 'https://%s/media/' % AWS_S3_DOMAIN

ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

How can I fix this. Please let me know if you need more info. I would be more than happy to provide

Samir Tendulkar
  • 1,151
  • 3
  • 19
  • 47
  • I think you need to check your network section of the browser to see if css and js are loading properly for summernote. – ruddra May 09 '19 at 05:09
  • 1
    @ruddra thanks buddy that helped. It seems `summernote` had a static file. I could do collect static and get it but I manually copied and pasted it in my aws static foder and that did the job. If you want to post this as a answer I can choose this as the correct answer. Thanks again – Samir Tendulkar May 10 '19 at 11:00

1 Answers1

1

I think you need to check your network section of the browser, to check if the required css and js are loading properly. There are documentations on how you can access network property on Firefox and Chrome.

If you are using tools like django-storage, then running python manage.py collectstatic is usually suffice to push those static files in S3(or manually copy pasting files will work but not recommended).

ruddra
  • 50,746
  • 7
  • 78
  • 101
  • Why is copying and pasting of the files in the aws folder not recomended – Samir Tendulkar May 11 '19 at 12:37
  • Well, lets say you have updated django-summernote or any library, then the js file would be updated as well. If you update the files manually, then it would be a hassle and hard to maintain. :) I always prefer automated system. – ruddra May 11 '19 at 13:59