Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » How to serve a static html file instead of rendering it as a template. [RSS Feed]

#1 June 11, 2010 07:59:51

l.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to serve a static html file instead of rendering it as a template.


Hi all,
I am wondering how I can serve an html file without having to have
Django think it's a template file.

In my html file, because there are markups that confuse Django, I'd
like to serve it as it is. I tried to read the html file directly into
Django, and use HttpRespont(htmlText) to get around Django. But Django
keeps giving me error message: "No such file or directory".

I appreciate your helps.

--l

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 11, 2010 09:18:14

Daniel R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to serve a static html file instead of rendering it as a template.


On Jun 11, 7:12 am, lalaba <seanfe...@gmail.com> wrote:
> Hi all,
> I am wondering how I can serve an html file without having to have
> Django think it's a template file.
>
> In my html file, because there are markups that confuse Django, I'd
> like to serve it as it is. I tried to read the html file directly into
> Django, and use HttpRespont(htmlText) to get around Django. But Django
> keeps giving me error message: "No such file or directory".
>
> I appreciate your helps.
>
> --l

Django won't think anything is a template unless you explicitly load
it as one and render it. If you want to load it and serve it, you can
just do so. But you don't show enough code above to know what's
actually going wrong.

Note that this is a very inefficient way to do things - you'd be
better off serving your file outside of Django, in the same way as you
serve your static assets.
--
DR.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 11, 2010 10:02:54

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to serve a static html file instead of rendering it as a template.


I think it is all explained in here :http://docs.djangoproject.com/en/dev/howto/static-files/As mentionned by every body around...
It is ok in DEV but ... you should not do so in other environment.

\T,


On Jun 11, 8:12 am, lalaba <seanfe...@gmail.com> wrote:
> Hi all,
> I am wondering how I can serve an html file without having to have
> Django think it's a template file.
>
> In my html file, because there are markups that confuse Django, I'd
> like to serve it as it is. I tried to read the html file directly into
> Django, and use HttpRespont(htmlText) to get around Django. But Django
> keeps giving me error message: "No such file or directory".
>
> I appreciate your helps.
>
> --l

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 11, 2010 12:43:57

Antoni A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to serve a static html file instead of rendering it as a template.


Just modify your server configuration to directly serve the folder and
do not sent it to django. It's the same you'll do for media files.

Hope it helps!


--
Antoni Aloy López
Blog:http://trespams.comSite:http://apsl.net--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » How to serve a static html file instead of rendering it as a template. [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support