#25800: IIS ISAPI request throws AppRegistryNotReady: Apps aren't loaded yet.
-------------------------------+--------------------
     Reporter:  atarkowska     |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  HTTP handling  |    Version:  1.8
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 After deep investigation of why IIS throws ''A server error occurred.
 Please contact the administrator.`'' looks like

 {{{

 url(r'^render_template/', views.render_template, name="render_template"),


 def render_template(request):
     try:
         logger.error("test template iis")
         context = {'foo': 'template'}
         t = template_loader.get_template('webclient/test.html')
         c = RequestContext(request, context)
         return HttpResponse(t.render(c))
     except:
         logger.error(traceback.format_exc())
         return HttpResponse(traceback.format_exc())
 }}}

 throws

 {{{
 Traceback (most recent call last): File
 "C:\OMERO.server\lib\python\omeroweb\webclient\views.py", line 36, in
 render_template t = template_loader.get_template('webclient/test.html')
 File "C:\Python27\lib\site-packages\django\template\loader.py", line 35,
 in get_template return engine.get_template(template_name, dirs) File
 "C:\Python27\lib\site-packages\django\template\backends\django.py", line
 30, in get_template return
 Template(self.engine.get_template(template_name, dirs)) File
 "C:\Python27\lib\site-packages\django\template\engine.py", line 167, in
 get_template template, origin = self.find_template(template_name, dirs)
 File "C:\Python27\lib\site-packages\django\template\engine.py", line 141,
 in find_template source, display_name = loader(name, dirs) File
 "C:\Python27\lib\site-packages\django\template\loaders\base.py", line 13,
 in __call__ return self.load_template(template_name, template_dirs) File
 "C:\Python27\lib\site-packages\django\template\loaders\base.py", line 17,
 in load_template template_name, template_dirs) File "C:\Python27\lib\site-
 packages\django\template\loaders\app_directories.py", line 36, in
 load_template_source for filepath in
 self.get_template_sources(template_name, template_dirs): File
 "C:\Python27\lib\site-
 packages\django\template\loaders\app_directories.py", line 26, in
 get_template_sources template_dirs = get_app_template_dirs('templates')
 File "C:\Python27\lib\site-packages\django\utils\lru_cache.py", line 125,
 in wrapper result = user_function(*args, **kwds) File "C:\Python27\lib
 \site-packages\django\template\utils.py", line 122, in
 get_app_template_dirs for app_config in apps.get_app_configs(): File
 "C:\Python27\lib\site-packages\django\apps\registry.py", line 137, in
 get_app_configs self.check_apps_ready() File "C:\Python27\lib\site-
 packages\django\apps\registry.py", line 124, in check_apps_ready raise
 AppRegistryNotReady("Apps aren't loaded yet.") AppRegistryNotReady: Apps
 aren't loaded yet.
 }}}

 Note above error appear only with IIS response rendering template, plain
 HttpResponse("string") or JsonResponse, HttpResponseRedirect works as
 expected.

--
Ticket URL: <https://code.djangoproject.com/ticket/25800>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.ca95a08db11d7dbe8baeb0956dd1025f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to