django ckeditor running into unexpected errors - django

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.

Related

Django web site URLS gets "?next=" randomly after deployed to heroku

After deploying django app on heroku the url after every form submission or link in site been press resulting with "?next=" inserts into the URL address, I don't understand from where it comes and why heroku keep inserting them in a random way, running the application locally just working perfectly.
I've deleted the application from heroku and upload it again, the fault persists.
There's no http errors what so ever. If I keep submitting the form eventually will works.
For example: pressing the log button in the django admin console results with this URL: https://appname.herokuapp.com/admin/login/?next=/admin/login/admin/, hitting it quite a bit will finally make it work with the correct url display: https://mishnayot.herokuapp.com/admin/.
Switching from heroku postgres to AWS RDS postgres didn't help.
Help will be very appreciated.
When a user hits a page requiring authentication, they get redirected to the login URL with a ?next= indicating the page they were trying to access. This way, after they've logged in, they'll get the page they intended to access.
In your case, it seems like /admin/login/admin/ requires a login and the login is actually at /admin/login/. I'm guessing you have a bad link to /admin/login/admin/ somewhere when you intended to just have /admin/login/?
Well, struggling for days just to understand it's heroku backend issue and there's not enough information that could help me solving it (i did try to contact heroku support directly but I'm on a free account).
Finally I decided to deploy it using elastic beanstalk. The implementation took some time with long learning curve but now my site works and works great!
Thanks for trying to help Tim.
Cheers!

Is there a way to use the python model "webbrowser" with Heroku?

I am working on deploying a django app to heroku and I am having trouble with the webbrowser module. The function initially creates a pdf from html using pdfkit (this part works fine). Afterwards, I use '''webbrowser.open_new_tab''' to render the pdf in a new tab. This works perfectly locally, but not when I deploy to Heroku :( I checked the Heroku log, and it indicates that the pdf is being properly compiled and that the webbrowser command is successfully called, but alas, a new tab is not opened... Are there any suggestions on how best to tackle this issue? Perhaps I am missing an important environment variable that allows me to open new pages on the user's browser?
Thank you,
-- Carter

Using Django + easy-thumbnails/sorl-thumbnail on Elastic Beanstalk

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

Admin media disappear while running django trunk in development mode

I got into django recently and start playing around with the tutorials & documentation (with the development version). Everything has been fine till I decide to update again to the latest django trunk and well my admin media are not showing up at all!
After some troubles, I managed to get admin media showing by commenting out django.contrib.staticfiles. However as I do use the staticfiles app to manage my site static files, I need it to be enabled. After some troubles, I manage to get both admin media and staticfiles showing by using manage.py collectstatic to collect the admin media files to my static folder.
However is there a way for me to serve admin media in DEBUG mode easily like last time without using collect static command? as I don't want to call the collectstatic every time when django admin media files got changed in trunk? (though I don't know how often/rare that is)
Django trunk is changing how static files are served, and in fact new changes landed this morning.
You'll want to get latest again, and then start here: http://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/

Django admin logging out on model save

I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo)
The problem is that the session expires whenever anything needs to be saved in the Django admin (either added or changed). If you try again, sometimes it works. This does not happen on my own machine when I run the Django dev server.
The timezone in both of the app settings.py files is the same, which is the same as the timezone in both of the .htaccess files.
The apps are almost identical, except the working app uses WYMEditor and the broken one uses TinyMCE as its text editor. Don't know why that would do anything to cause the problem, but I included it just in case. Also, I've made a custom CSS file for the admin backend in the broken app (again, shouldn't cause a problem).
Seems to have been a configuration issue with the company I was hosting with - it's not happening anymore.