I'm having some issues using Django and easy_thumbnails on Elastic Beanstalk and I'm not really sure what's going wrong... Here's the problem:
I'm using easy_thumbnails to do my thumbnailing in the template. I like the flexibility this gives me, so I'd rather not do the thumbnailing in the model. When I upload an image it's stored in the database fine and is uploaded to and EBS volume. So far so good. My problem lies in that I can't thumbnail any images. If I turn on thumbnail debug it seems that easy_thumbnails isn't reading/finding the image. I suspect this problem may have something to do with my media url settings, but I'm at quite a loss as to what to change.
Has anyone else had experience with either sorl_thumbnail or easy_thumbnails? I'd really appreciate any guidence. On my local development server my thumbnails work perfectly fine.
Easy-thumbnails has no easy support for AmazonS3, you can apply this setup to make it work http://gibuloto.logdown.com/posts/99941-easy-thumbnails-with-amazon-s3
As mentioned here: Django-Storages + Easy_Thumbnails: [Errno 30] Read-only file system
Related
I hope someone can help out with this one. I have been using djangocms to build a simple frontend centric website for a client so they can maintain their own content. There is nothing fancy in this setup. Just a few template.html files, a little css and djangocms to pull it all together. There are no other forms, models, views or anything at this stage. Just pure djangocms.
Originally I was working with django 1.8.6 and the image picker seemed to work fine. I could upload my files and next to each one there is a selector icon which works and all was great. See below image. This was using cmsplugin-filer.
Then I tried to upgrade the website to Django version 1.11.13 and I started to run into this problem. The file select that you see above is no longer available to the user. I have spent days working on this and in my travels I found that apparently cmsplugin-filer is now deprecated. So I removed it and switched to the recommended djangocms-filer install thinking that might solve my problem...but no. After many many hours of head scratching I figured it must be something in my project throwing things out, so I have done a 100% clean install using the prescribed djangocms-installer. Other than connecting it to a postgresql database, it is a completely vanilla installation, and yet it still does not work. All I get is the image below. A simple tick box but no way of selecting the image nor anyway of saving what I have selected. Uploading files is fine and I can create folders and images upload into them perfectly fine.
Below is a snapshot of my pip freeze showing everything installed in my virtualenv and the associated versions.
My settings file is almost 100% standard so I don't understand why I can't get this to work. Note: If, when I am adding the plugin to my template, I don't select the Choose File Button but simply drag an image into the grey rectangle, it all works fine. My file gets uploaded into the unsorted uploads folder and the image is selected into my template all in one go, but using the choose file route, where I have more control over my files and how they are stored, doesn't.
Does anyone have any idea what I might be missing please?
UPDATE:
Django CMS overrides some static files and there are some old ones in your browser cache. You need to clear your caches or open the page using incognito window.
I am using django-ckeditor python package in my django app (django 1.11 + python 2.7). I have integrated it with s3 and it is hosted on Heroku. So far everything runs smooth.
Earlier I had an issue that non admin user could not upload images to server thus can not use any images as a part of their content. I fixed it by overriding ckeditor's browse and upload view. When i tested it it was working just fine. I pushed it to production.
Now none of my user can use ckeditors image upload or browse feature. when I try it, (as an admin or as regular user) it works. some users reported that app crashes, some said image wont show up despite uploading to server (also I can't see it in my s3 bucket.)
other images are working well with s3 for all users. but ckeditors images are working only for me, no matter which machine or which role I try as.
I also checked heroku apps, but they are not helpful at all.
Does anyone have idea any guesses why this could be happening.
It is my first time trying to get a Django application live on the net but I am having an issue with the URls.
The working local URL of my application is
http://localhost:8000/surveythree/ - This works as expected.
However when I upload my project to my hosting account I cant seem to locate the relevant page using the shortened URL as provided by the URLconf, in this case it should be /surveythree/
url(r'^surveythree/$', SurveyWizard.as_view([SurveyForm1, SurveyForm2, SurveyForm3, SurveyForm4, SurveyForm5])),
I can locate the page if I use the full filepath however.
http://www.mywebsite.com/bias_experiment/src/survey/templates/formtools/wizard/wizard_form.html
I thought the benefit of the URLconf was to shorten the URL to something like one of the following
http://www.mywebsite.com/bias_experiment/surveythree/
http://www.mywebsite.com/bias_experiment/src/surveythree/
http://www.mywebsite.com/bias_experiment/src/survey/surveythree/
Is there something simple that I am missing here? If anyone could tell me what the shortened URL should be based on the above it would be great. I have been trying multiple combinations for a while now but I don't know if I am going around in circles or doing it wrong.
Thanks in advance.
It doesn't look like you have actually deployed your site with a proper server. You can't just upload the files to any webserver and expect then to run: you need to configure a wsgi server and connect it to your app.
The documentation is here but to be honest I'd be amazed if your college server supported it at all, if all you have is a shared folder. You may be able to get it to work with FastCGI, but I wouldn't hold out a whole lot of hope.
(And even though you say that going to that long URL "works", I'd guarantee that all you're seeing is the raw HTML template. There's no way that any actual dynamic functionality will be working like that, as you'd see if you actually tried to submit the form at that URL.)
Deploying Django apps is much more complicated. To run in more "production" environment you will need to configure:
virtualenv to keep pip modules which your app required separate from global environment.
nginx for hosting static files ( you can copy them to some folder with ./manage.py collectstatic.
WSGI server: uWSGI or Gunicorn are both nice choices.
supervisor: for running and restarting WSGI and any other apps (for example celery) running in background
It's a lot for a start, so it's good to follow some tutorial and use ready to use config snippets.
I have an app on Heroku (the free plan) and regularly get Application Error on media files uploads from Django admin. I use S3 for serving static&media.
What is the best way to upload files to S3 directly via django admin? Or maybe there is some other way to mitigate this problem (withot adding dynos)?
Try one of the following:
s3 direct.:
With s3 direct the file would be uploaded directly to s3.
Increase Server Timeout
You can increase your server timeout --- guessing you are using Gunicorn .
Note that this could have repercussions, unfortunately I don't fully know what kind of repercussions
You can use django-storages for this
#acquayefrank's suggestion worked for me. I have a Django project and I was having trouble uploading about 120 MB+ files through the Django Admin.
I changed my Procfile to say this (replace yourname with the dotted path to your .wsgi):
web: gunicorn --timeout 120 yourname.wsgi --log-file -
I can't say for certain that this will solve everyone's same issue but might be worth a try.
This article outlines how you can upload directly to S3 with the assistance of Javascript. You could then potentially use custom Javascript in the Django admin to achieve the same outcome. Hope it helps.
not able to view my pictures on the template
1)added avatar to installed apps
2) edited urls
3) added code in temlplates
kindly help if any other change is required?
You have probably not setup the media and static url settings in settings.py either that or you have not configured the HTTP server you are running to display images from those locations (assuming you are not using the dev server). Obviously it is hard to help with no information so perhaps providing a bit more might be useful (some code for example).