Forums

Embedding a PythonAnywhere site via iframe

Is it possible to embed a PA site in another website? e.g. if I have a PA site "example.com", <iframe src='example.com'></iframe> results in the console error:

Refused to display 'example.com' in a frame because it set 'X-Frame-Options' to 'deny'.

Is this something we can change on our end?

Sorry, I realise this is a Django setting - would love to hear if there are any best practices around this though!

I would say keep the 'X-Frame-Options' setting as deny, and use the xframe_options_exempt decorator for your one particular view which uses a PythonAnywhere iframe?