Thursday, January 30, 2014

Re: render .txt file in django template

But the document says that static media isn't about django, but apache (for production). Loading static file contents in the view.py seems to me not effecient.

I am now on development phase, and I think I should render static files in the template now. And in the production phase, I would change just the shortcuts..

Am I wrong?


--


30 Ocak 2014 Perşembe 23:33:11 UTC+2 tarihinde C. Kirby yazdı:
The template engine doesn't have direct access to the filesystem. You will have to pass the file contents from your view to the template:

1.Load the file in your view
2. Read it into a context variable.
3. Render the context variable in your template

On Thursday, January 30, 2014 3:29:29 PM UTC-6, Fatih Tiryakioglu wrote:
Hi all,

Could you please show me how can I render .txt static files (they are user comments) in django template? I couldn't resolve that issue for a month..

I appreciate your help.


--

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b73bfc84-e005-41d0-aa78-a652e0a4ccb5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment