Thanks. But I worked around the solution by adding a empty app to the 
INSTALLED_APPS that points to an empty .py file. Seems to work, but I get some 
random errors from my custom filers file saying that they don't exists.

When searching around I found that it's a bit confusing for many developers to 
get django 1.1 running. Is there any guides?

My main reason for upgrading to 1.1 is to use for-loop with {% for name, type 
in obj %}.

What is the mere basic you need to get 1.1 running (hopefully with out any 
random errors). As of now I only have a settings.py:

import os.path

PROJECT_DIR = os.path.dirname(__file__) # this is not Django setting.
TEMPLATE_DIRS = (
    os.path.join(PROJECT_DIR, "templates"),
    # here you can add another templates directory if you wish.
)


And in top of all my .py:

import os, sys, cgi, re, logging

# Google App Engine imports.
from google.appengine.ext.webapp import util

# Remove the standard version of Django.
for k in [k for k in sys.modules if k.startswith('django')]:
    del sys.modules[k]

# Force sys.path to have our own directory first, in case we want to import
# from it.
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

# Must set this env var *before* importing any part of Django
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from google.appengine.dist import use_library
use_library('django', '1.1')
from django.conf import settings 
settings.configure(INSTALLED_APPS=('empty',)) 

from google.appengine.ext.webapp import template
....


What do I need to replace google's template import? Is there any other files I 
need? 

The solution above works (in some sense) but it seems a bit like it could break 
any moment. Especially pointing out a empty app and del modules from 
sys.modules.

Is there something google does to set the version to 0.96? And could these two 
settings interfere with each other?


..fredrik






On 17 maj 2010, at 22.13, Roger Hu wrote:

> This import is causing massive headaches on App Engine deployments
> with TemplateDoesNotExist sporadic messages.  Assuming you have Django
> 1.1 setup correctly, the global_settings.py file will setup
> TEMPLATE_LOADERS to load from both the project dir (/templates) as
> well as any INSTALLED_APPS dir.  But we noticed sporadic issues with
> App Engine reporting the issue:
> 
> TemplateDoesNotExist: Tried [u'/base/data/home/apps/
> myapp1234/1-2-2-8.341999523263263665/templates/volunteer-11.html']
> 
> The reason?
> 
> By default, Django has these two TEMPLATE_LOADERS defined in its
> global settings (defined in conf/global_settings.py):
> 
> TEMPLATE_LOADERS = (
>    'django.template.loaders.filesystem.load_template_source',
>    'django.template.loaders.app_directories.load_template_source',
> )
> 
> The second line tells Django to try all the INSTALLED_APPS dirs
> whenever attempting to render an HTML template.   For instance, we do
> not need to specify volunteer-11.html because it will try to look
> inside ragendja/templates, accounts/templates, and civio/templates, in
> the order defined by INSTALLED_APPS inside settings.py:
> 
> INSTALLED_APPS = (
>    'django.contrib.auth',
>    'django.contrib.sessions',
>    'django.contrib.admin',
>    'ragendja',
>    'accounts',
>    'civio'
> )
> 
> 
> If you accidentally import this line in your Python code,
> 
> from google.appengine.ext.webapp import template
> 
> The GAE reconfigures TEMPLATE_LOADERS inside
> google.appengine.ext.webapp.template:
> 
> import django.conf
> try:
>  django.conf.settings.configure(
>    DEBUG=False,
>    TEMPLATE_DEBUG=False,
>    TEMPLATE_LOADERS=(
>      'django.template.loaders.filesystem.load_template_source',
>    ),
>  )
> 
> +#from google.appengine.ext.webapp import template
> 
> The result is TemplateDoesNotExist messages that may or may not occur.
> 
> 3. If you are using Django 1.1, you must be careful that you're not
> importing google.appengine.ext.webapp import template.  The solution,
> I believe, is to simply remove all webapp dependency imports:
> 
> perl -pi.bak -e "s/^from google\.appengine\.ext\.webapp(.*)/#from
> google.appengine.ext.webapp\1/g" *.py
> 
> We're still confirming that these changes will resolve the issue, but
> it seems to explain the problem we have been having on Django 1.1.
> 
> Roger
> 
> On May 10, 12:25 pm, Fredrik Bonander
> <carl.fredrik.bonan...@gmail.com> wrote:
>> I have a similar problem. When I updated to django 1.1 I get 
>> TemplateSyntaxError: Template u'../index.html' cannot be extended, because 
>> it doesn't exist.
>> 
>> It seams that the problem lies in that the TEMPLATE_DIRS is not set wrong. 
>> But I don't know how set in as a relative path.
>> 
>> Anyone successfully used django 1.1 in GAE?
>> 
>> ..fredrik
>> 
>> On May 8, 2010, at 2:27 PM, allyourcode wrote:
>> 
>> 
>> 
>> 
>> 
>>> I think the problem is that my TEMPLATE_DIRS gets cleared at some
>>> point, even though my app doesn't do that, at least not directly. My
>>> guess is that this is happening somewhere in the SDK or Django helper
>>> to implement the admin pages, but I can't tell which piece is doing
>>> the manipulation :/.
>> 
>>> I'll try to upgrade my SDK, but again, when I tried this before, my
>>> app ended up dead in the water (forget what issues I was running into
>>> before).
>> 
>>> On May 7, 2:08 am, "Nick Johnson (Google)" <nick.john...@google.com>
>>> wrote:
>>>> Hi,
>> 
>>>> It's impossible to suggest what might be wrong without seeing the code in
>>>> question. It looks like you're probably running into problems with relative
>>>> or absolute paths, or your css file is marked as static in your app.yaml.
>> 
>>>> You should definitely upgrade your SDK - 1.3.3 is the latest version, and
>>>> 1.2.7 is very much out of date.
>> 
>>>> -Nick Johnson
>> 
>>>> On Fri, May 7, 2010 at 1:00 AM, allyourcode <allyourc...@gmail.com> wrote:
>>>>> Hi,
>> 
>>>>> I'm having a problem developing my GAE application. It's been reported
>>>>> as issue 464 on the GAE issue tracker, but it's not getting any
>>>>> attention, due to difficulties with reproducing the issue; hence, I'm
>>>>> turning to the GAE group to look for support.
>> 
>>>>> Restarting the dev server temporarily gets rid of the problem, but it
>>>>> keeps coming back. I'm worried this problem will come up in
>>>>> production, but we haven't released our app yet, so I've never had a
>>>>> chance to see how it works in production.
>> 
>>>>> One symptom of the problem is if you go to
>>>>> http://localhost:8000/_ah/admin/interactive
>>>>> and enter a correct program, and it hit "Run Program", the following
>>>>> output is (sporadically) generated:
>> 
>>>>> Traceback (most recent call last):
>>>>>  File "c:\Program Files\Google\google_appengine\google\appengine\ext
>>>>> \webapp\__init__.py", line 507, in __call__
>>>>>    handler.get(*groups)
>>>>>  File "C:\Program Files\Google\google_appengine\google\appengine\ext
>>>>> \admin\__init__.py", line 737, in get
>>>>>    self.generate('datastore.html', values)
>>>>>  File "C:\Program Files\Google\google_appengine\google\appengine\ext
>>>>> \admin\__init__.py", line 131, in generate
>>>>>    self.response.out.write(template.render(path, values,
>>>>> debug=_DEBUG))
>>>>>  File "c:\Program Files\Google\google_appengine\google\appengine\ext
>>>>> \webapp\template.py", line 80, in render
>>>>>    t = load(template_path, debug)
>>>>>  File "c:\Program Files\Google\google_appengine\google\appengine\ext
>>>>> \webapp\template.py", line 108, in load
>>>>>    template = django.template.loader.get_template(file_name)
>>>>>  File "<app_root>\django.zip\django\template\loader.py", line 81, in
>>>>> get_template
>>>>>  File "<app_root>\django.zip\django\template\loader.py", line 89, in
>>>>> get_template_from_string
>>>>>  File "<app_root>\django.zip\django\template\__init__.py", line 166,
>>>>> in __init__
>>>>>  File "<app_root>\django.zip\django\template\__init__.py", line 187,
>>>>> in compile_string
>>>>>  File "<app_root>\django.zip\django\template\__init__.py", line 283,
>>>>> in parse
>>>>>  File "<app_root>\django.zip\django\template\loader_tags.py", line
>>>>> 169, in do_extends
>>>>>  File "<app_root>\django.zip\django\template\__init__.py", line 283,
>>>>> in parse
>>>>>  File "<app_root>\django.zip\django\template\loader_tags.py", line
>>>>> 147, in do_block
>>>>>  File "<app_root>\django.zip\django\template\__init__.py", line 283,
>>>>> in parse
>>>>>  File "<app_root>\django.zip\django\template\loader_tags.py", line
>>>>> 187, in do_include
>>>>>  File "<app_root>\django.zip\django\template\loader_tags.py", line
>>>>> 102, in __init__
>>>>>  File "<app_root>\django.zip\django\template\loader.py", line 80, in
>>>>> get_template
>>>>>  File "<app_root>\django.zip\django\template\loader.py", line 73, in
>>>>> find_template_source
>>>>> TemplateDoesNotExist: css/datastore.css
>> 
>>>>> When I restart the server, visit some pages in my app in another
>>>>> window, and go back to the original window containing the script was
>>>>> trying to run in the Interactive Console, I'm able to run it
>>>>> successfully without modification (this is how I know the program is
>>>>> correct).
>> 
>>>>> Here are my versions:
>> 
>>>>> GAE SDK 1.2.7
>>>>> Django 1.0
>>>>> GAE Django Helper r95
>>>>> Python 2.5.4
>>>>> Windows XP Home Edition SP3
>> 
>>>>> I know there's a new version of the SDK, but when I tried upgrading,
>>>>> my app stopped working, so I reinstalled version 1.2.7, which is
>>>>> (otherwise) working fine for me.
>> 
>>>>> I know other people have experienced this. Has anyone found a
>>>>> solution?
>> 
>>>>> Thanks,
>> 
>>>>> allyourcode
>> 
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups
>>>>> "Google App Engine" group.
>>>>> To post to this group, send email to google-appeng...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> google-appengine+unsubscr...@googlegroups.com<google-appengine%2Bunsubscrib
>>>>>  e...@googlegroups.com>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/google-appengine?hl=en.
>> 
>>>> --
>>>> Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. 
>>>> ::
>>>> Registered in Dublin, Ireland, Registration Number: 368047
>>>> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
>>>> 368047
>> 
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "Google App Engine" group.
>>>> To post to this group, send email to google-appeng...@googlegroups.com.
>>>> To unsubscribe from this group, send email to 
>>>> google-appengine+unsubscr...@googlegroups.com.
>>>> For more options, visit this group 
>>>> athttp://groups.google.com/group/google-appengine?hl=en.
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Google App Engine" group.
>>> To post to this group, send email to google-appeng...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> google-appengine+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/google-appengine?hl=en.
>> 
>> --
>> Fredrik Bonander
>> carl.fredrik.bonan...@gmail.com
>> +46 70 943 5441
>> 
>> - the infinite power of the creative mind -
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Google App Engine" group.
>> To post to this group, send email to google-appeng...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group 
>> athttp://groups.google.com/group/google-appengine?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
> 

--
Fredrik Bonander
carl.fredrik.bonan...@gmail.com
+46 70 943 5441

- the infinite power of the creative mind - 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to