On Feb 15, 10:16 am, Praveen Krishna R
wrote:
> *plz Check django official docs to find out how static files are served on
> production and development server.*
> *
> *
> *in the dev server include a similiar snippet into your projects
> urls.py, urlpatterns:*
> *
> *
> *(r'^site_media/(?P.*)$',
Sorry, other posters have picked up two of my errors.
It is a while since I used application/json and I was running on
(incorrect) memory. My reasoning for using plain text is as follows.
I regard parsing JSON using eval() as a security risk on the client
side. If you have complete control of th
Hi Alex, here is a small example of a JSON response. I don't mix HTML
and JSON personally (I use HTML pages and then fetch JSON via AJAX
calls so).
Here is a fragment of code from one of my views:
t = loader.get_template('members/member_info.json')
c = Context({'member_set':member_set})
Cool. That is a clever way to subvert (I don't mean this negatively)
the response generation. I do have a couple of comments:
1) It relies on the response being sent to the client as it is
generated and not buffered by the server. That is clearly working for
you and I don't know the internals of
Just one comment - Django lets you render to JSON just as easily as
rendering to HTML (or XML). You just write your template as JSON and
set the MIME type for the response accordingly. Because I control my
JSON parsing on the client side, I set the MIME type to text/plain but
you could set to ano
utility functions then they can be pulled out into separate modules.
Once you realise that the views.py is only a convention then it just
becomes a question of structuring a large Python app.
Hope this helps,
Ian McDowall
On Jun 15, 5:55 am, Joel Klabo wrote:
> I am working on a simple site right
?
Regards, Ian McDowall
On Jun 11, 4:15 pm, Christoph wrote:
> Hi,
>
> normally in views.py I have a function that takes a request and
> returns a render_to_response or the like. I, however, would like it to
> take a request and have Django reply with multiple responses. Is there
>
I had the same issue but I also wanted to create additional data for
each user. It was straightforward to create a script to add users.
I needed to import some bits to set up the Django environment and then
I was able to create users with standard Django calls. Here is
extracts from my code (with
s just XMl and Django's templating works fine
for that. There are some technical catches about the type of the
document and namespaces but I can provide a worked example. The
drawback is that not all browsers support SVG well. This appears to
work well in recent ver
9 matches
Mail list logo