Django Library

46 views
Skip to first unread message

Max

unread,
Nov 18, 2011, 4:13:29 AM11/18/11
to google-a...@googlegroups.com
Hi,
I got this error in my logs:
You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see http://code.google.com/appengine/docs/python/tools/libraries.html#Django
My code is:
from django.utils import simplejson as json

In the documents there is written to change it like this:
import os
os
.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from google.appengine.dist import use_library
use_library
('django', '1.1')


But I'm importing just a specific library.
How do I have to set it? I can't understand.

Thanks

Max


N. Rosencrantz

unread,
Nov 18, 2011, 5:55:33 AM11/18/11
to google-a...@googlegroups.com
I recommend switching to python 2.7 that abstracts away selecting the django version.
There is a blog post how to do it at blog.notdot.net
If you can't or don't want to upgrade to python 2.7 now you can add a line to your appengine_config.py to select which version django imports.

I used django for filters and templates. Now I swtiched to Jinja2 but I still need django's translation capabilities so I didn't get out of django completely since I use django.util.translations however the recommendation
is likely to not import django at all since it seems that GAE is moving away from django and onto selecting your own stack eg. choose a template engine and choose a db framework and choose a forms framework and
it can work very well no django imports.

I hope some of this info helps.
Regards,
Niklas

Massimiliano

unread,
Nov 18, 2011, 5:59:37 AM11/18/11
to google-a...@googlegroups.com
I'm not so skilled to do it. I'm just using appengine like an hobby. I just want to use the code like I have. Which line I have to add and where?

2011/11/18 Niklas Rosencrantz <nikl...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/2qKVzgTPp2AJ.

To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



--
How to contact me: protocol.by/Massimiliano
Skype: massimiliano.pietroni

N. Rosencrantz

unread,
Nov 18, 2011, 6:09:07 AM11/18/11
to google-a...@googlegroups.com
You can keep a file called appengine_config.py in your project directory with this line:

webapp_django_version = '1.2'

and I think it will solve your problem. Or just wait and keep your code compatible with current GAE SDK and you will solve the problem since sooner or later 0.96 will be deprecated since it is old and it is over.

Regards,
Niklas

Massimiliano

unread,
Nov 18, 2011, 6:14:58 AM11/18/11
to google-a...@googlegroups.com
Great, I'll do it! Thanks!!!!

2011/11/18 Niklas Rosencrantz <nikl...@gmail.com>

Bryce Cutt

unread,
Nov 18, 2011, 5:06:16 PM11/18/11
to Google App Engine
A description of the steps (with examples) can be found in the answers
here:
http://stackoverflow.com/q/4994913/98138

As Niklas mentioned things will be a lot easier with the new Python
runtime but for now the easy fix is at the link I provided.

Some things changed between Django .96 and 1.2 and you will need to
retest all your Django code, especially your templates. The one thing
I ran into (that was unexpected but easy to fix) is that Django 1.2
escapes all template variables by default so if your variable has "&"
in it's value it will be auto-escaped to &amp; and so will all the
other standard HTML special characters. This can cause unexpected
results, especially if you are already escaping things yourself. If
you find this is an issue for a particular variable you can use the
"safe" Django filter (https://docs.djangoproject.com/en/1.2/ref/
templates/builtins/#safe) to indicate to Django that it should not
escape that variable's value.

Good luck.

- Bryce


On Nov 18, 1:13 am, Max <massimiliano.pietr...@gmail.com> wrote:
> Hi,
> I got this error in my logs:
>

> You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information seehttp://code.google.com/appengine/docs/python/tools/libraries.html#Django

Reply all
Reply to author
Forward
0 new messages