Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
On Friday 03 March 2017 20:37:29 Tom Tanner wrote: > When the iframe requests > `/interactive`, it loads `interactive-1/index.html`. But the iframe still loads /interactive. So it's base url is /interactive and a request for scripts/main.js is /interactive/scripts/main.js. Unless you either: 1/ Do a redirect, which is the simplest 2/ Request your resources incorporating the session id I still would go for 1/, simply because that fixes the disconnect between template path / view path and requested url. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1534032.trWzQqoBk9%40devstation. For more options, visit https://groups.google.com/d/optout.
Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
there is a lack of information here, though you last post suggests maybe you missed a couple of template tags at the start of you index.html add: {% load staticfiles %} and then when adding you scripts use: -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a87d42ff-b73d-4c59-b384-e77a5a52971d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
On Saturday, 4 March 2017 15:57:49 UTC, Tom Tanner wrote: > > >How are you referring to the assets in the template? > > In `interactive/index.html`, in the `` tag, I have ` src="scripts/main.js">` > Well, if you wanted to load the scripts from /interactive-1/scripts/main.js, then that's what you should use as the src, surely? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5fe5c543-8d35-4521-836b-163de1554a72%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
>How are you referring to the assets in the template? In `interactive/index.html`, in the `` tag, I have `` On Saturday, March 4, 2017 at 8:55:22 AM UTC-5, Daniel Roseman wrote: > > On Saturday, 4 March 2017 13:30:37 UTC, Tom Tanner wrote: >> >> In my `views.py`, I have one path render an html file: >> >> def interactive(request): >> if request.session.get('interactiveID') == None: >> t= get_template('blank-interactive.html') >> else: >> interactive_template= 'interactive-' + str(request.session['id']) + >> '/index.html' >> t= get_template(interactive_template) >> >> return HttpResponse(t.render()) >> >> So `form.html` has an `` that requests `/interactive`, and >> `request.session['id']` is set to `1`. When the iframe requests >> `/interactive`, it loads `interactive-1/index.html`. The iframe loads the >> HTML from that page, but cannot get the JS file at >> `interactive-1/scripts/main.js`. >> >> When I check the terminal, I see this 404 error: `GET >> /interactive/scripts/main.js`. If it would just load >> `/interactive-1/scripts/main.js`, there would be no problem. But Django >> loads `/interactive-1/index.html`, but not >> `/interactive-1/scripts/main.js`. Same goes for the CSS and image assets, >> which are in CSS and image folders. >> >> What do I need to change in Django for it to correctly load the JS, CSS, >> images and other assets? >> > > There's not really enough information here to answer your question. How > are you referring to the assets in the template? Why do you have a > different path for those assets? Note though that template paths and asset > paths have nothing whatsoever to do with each other. > -- > DR. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7a788ad6-a6bb-4586-8a89-681ceacb857c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
On Saturday, 4 March 2017 13:30:37 UTC, Tom Tanner wrote: > > In my `views.py`, I have one path render an html file: > > def interactive(request): > if request.session.get('interactiveID') == None: > t= get_template('blank-interactive.html') > else: > interactive_template= 'interactive-' + str(request.session['id']) + > '/index.html' > t= get_template(interactive_template) > > return HttpResponse(t.render()) > > So `form.html` has an `` that requests `/interactive`, and > `request.session['id']` is set to `1`. When the iframe requests > `/interactive`, it loads `interactive-1/index.html`. The iframe loads the > HTML from that page, but cannot get the JS file at > `interactive-1/scripts/main.js`. > > When I check the terminal, I see this 404 error: `GET > /interactive/scripts/main.js`. If it would just load > `/interactive-1/scripts/main.js`, there would be no problem. But Django > loads `/interactive-1/index.html`, but not > `/interactive-1/scripts/main.js`. Same goes for the CSS and image assets, > which are in CSS and image folders. > > What do I need to change in Django for it to correctly load the JS, CSS, > images and other assets? > There's not really enough information here to answer your question. How are you referring to the assets in the template? Why do you have a different path for those assets? Note though that template paths and asset paths have nothing whatsoever to do with each other. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8176ee4a-9946-4c3a-80db-cab0d780e984%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error
In my `views.py`, I have one path render an html file: def interactive(request): if request.session.get('interactiveID') == None: t= get_template('blank-interactive.html') else: interactive_template= 'interactive-' + str(request.session['id']) + '/index.html' t= get_template(interactive_template) return HttpResponse(t.render()) So `form.html` has an `` that requests `/interactive`, and `request.session['id']` is set to `1`. When the iframe requests `/interactive`, it loads `interactive-1/index.html`. The iframe loads the HTML from that page, but cannot get the JS file at `interactive-1/scripts/main.js`. When I check the terminal, I see this 404 error: `GET /interactive/scripts/main.js`. If it would just load `/interactive-1/scripts/main.js`, there would be no problem. But Django loads `/interactive-1/index.html`, but not `/interactive-1/scripts/main.js`. Same goes for the CSS and image assets, which are in CSS and image folders. What do I need to change in Django for it to correctly load the JS, CSS, images and other assets? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d94bfa19-0250-4a90-93be-63e18889cb53%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.