blank page or KeyError in preview Wagtail 1.10.1 - django

I just upgraded to Wagtail 1.10.1 and the preview shows only a blank page. When I force the preview by appending preview/ to the edit URL, then I get a server error. It all works just fine on my development and staging sites, so I also need some help tracking down where the error might be.
Internal Server Error: /admin/pages/81/edit/preview/
KeyError at /admin/pages/81/edit/preview/
'wagtail-preview-81'
Django Version: 1.11.1
Python Executable: /usr/local/bin/uwsgi
Python Version: 3.5.2
I've been doing only minimal upgrades for a few months, so it's possible I missed something in a previous upgrade that used to work but that now I need to fix (although why it would work in the dev and staging sites but not the real one puzzles me); any suggestions would be welcome.

Please refresh your browser cache in the edit page (Ctrl + F5) then click again on preview.
The issue is that the admin Javascript changed, but Wagtail no longer compresses its assets, so your browser cached the previous version of the Javascript file. So preview data is not correctly sent to the server, and it’s therefore unable to retrieve it when displaying the preview.
You can avoid such issues in the future by compressing admin assets.

Related

Iframe stops working after upgrading to Django 3.2 LTS

I was using Django 2.2 up till now and I recently tried upgrading to Django 3.2
We use a website live chat plugin called tawk.to which works by embedding an iframe to our page with the chat option in there.
However, after upgrading to Django 3.2, even though the plugin's JS code is loading, the iframe is missing from the website altogether.
I am not sure what is causing the issue. Is the iframe blocked in Django 3.2 or do I have to enable any setting for it?
There are security updates are added in Django 3.2 which do not allow other frames. Refer https://docs.djangoproject.com/en/3.2/ref/clickjacking/#preventing-clickjacking.
You should change X_FRAME_OPTIONS = 'SAMEORIGIN' as explained in https://docs.djangoproject.com/en/3.2/ref/clickjacking/#how-to-use-it
I found the answer after going deep into the Django files. Add this to your settings.py file.
SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin". # when using other websites that track visitors or use their iframe on your website.
X_FRAME_OPTIONS = 'SAMEORIGIN' # Necessary to show Iframe from your own server (such as PDFs on your website)

Django admin page login causing IIS to crash, need to restart iis everytime

My site is working fine. I can access all the pages. But when I am accessing admin page, it loads, prompts for username and password. After entering username and password when clicked login, it takes sometimes and after that I get below error:
This page isn’t working mytestapp.company.com didn’t send any data.
ERR_EMPTY_RESPONSE
After refreshing the page, I get below error:
Service Unavailable HTTP Error 503. The service is unavailable.
After this no page loads. After restarting IIS using cmd (iisreset /noforce) again when I try to refresh the homepage, I see I am logged in which means admin page logged me in but after that response did not come and it something went wrong on the server side which caused server to crash.
I am not sure how to proceed with this. Earlier my admin site use to work fine. No recent changes in code. The only change I did is I synced the DB from another DB which has more data.
I am using virtual env which has
python version is 2.7.3, Django version 1.3 in it
IIS version 7.5 on WindowsServer 2008R2 (Python IsAPIe handler)
Please help me on this. I am stuck with this issue...
Issue is resolved now. IIS service was getting stopped because of a series of error caused while rendering admin page. After checking windows event log and understanding error code, got to know that the Python-Runtime.dll which admin page was referring was having some issue. I replaced the dll with the previous working version and then everything started working fine.

Django Debug Toolbar 1.10 (and 1.10.1) Not Showing

I've got django-debug-toolbar 1.9.1 working fine in my configuration (Django 2.1.2), but if I simply update it to 1.10 or 1.10.1, without changing anything else, it doesn't show up anymore. I don't see anything in the change logs that indicate I need to update any settings.
Does anyone have any suggestions? Or there a way I can turn on some kind of logging to see where it's not working?
Thanks!
This issue on GitHub was solved by refreshing the browser cache.
Try running manage.py collectstatic and refresh your browser cache, to make sure you aren't running javascript from an old version.
I had this issue when running 'manage.py runserver'. All I had to do is Refresh my browser cache. In Chrome, you just open View/Developer/Developer Tools and now right click the "Refresh" button and click 'Empty Cache and Hard Reload'.
That did it for me (using Chrome), same thing under Chromium. Cheers!

Django live preview without reloading the page

I am looking for live preview solution for Django project so as soon as I do change in the css or java-script files I would see these changes without reloading the page in the browser. My page is html page but it has django tags.
I tried the following solutions:
Atom - livereload plugin.
django-livereload 1.7
grunt
and others.
the Problem with these solutions that as soon I save my page after changes it will reload the whole page to see the changes.
Is there any solution for Django would preview changes without reloading the page and just will preview the changes.
I am using django development server to run djange website.
I am not looking for inline editor. I am looking for IDE that support live preview for django without reloading the page.

Joomla 2.5 admin page 404

Web site functioned normally , I tried to login to admin page and suddenly when I access admin page it display:
404 - An error has occurred.
Component not found
No new extension/module/component and theme has been installed.
No changes on PHP or mysql on the server side. ( I did check with hosting providers).
It's like it works today and tomorrow when you want to login , you'll see the above mentioned error.
Renaming .htaccess did not solve the issue.
Restoring DB backup did not solve the issue.
I checked the Joomla logs ( in log folder) there isn't any related report.
Joomla version info:
$RELEASE = '2.5';
$DEV_LEVEL = '16';
Please help!
I managed to sloved this long time ago but I forgot to update!
It is solved by running repair and optimize operations on the database via phpmyadmin.