1

I don't now why I seem to be getting the following errors from the Apache24 error log:

    mod_wsgi (pid=9036): Exception occurred processing WSGI script 'C:/Apache24/htdocs/tools/ixg_dashboard/ixg_dashboard.wsgi'.
    Traceback (most recent call last):
    File "C:/Apache24/htdocs/tools/ixg_dashboard/ixg_dashboard.wsgi", line 242, in application
    env = Environment(loader=PackageLoader('C:\\htdocs\\tools\\ixg_dashboard\\ixg_dashboard', 'templates'))
    File "C:\\Python27\\lib\\site-packages\\jinja2\\loaders.py", line 224, in __init__
    provider = get_provider(package_name)
    File "C:\\Python27\\lib\\site-packages\\pkg_resources\\__init__.py", line 419, in get_provider
    __import__(moduleOrReq)
    ImportError: Import by filename is not supported.

The .wsgi file is pretty long but I'll give the relevant parts of code. The imports are as follows:

    import cgi, urlparse, jinja2, os
    from pymongo import MongoClient
    from sets import Set
    from jinja2 import Environment, PackageLoader

and the actual code where I believe the issue may lie is:

   env = Environment(loader=PackageLoader('C:\htdocs\tools\ixg_dashboard\ixg_dashboard', 'templates'))
   table_template = env.get_template('table.html')
   print table_template.render()

The code was created by someone who was previously here and never got around to getting it fully working on the server but was able to get it to run locally which is what I'm trying to do. Is it possible that the issue lies in the httpd.config file for Apache and the code itself. I tried looking around and couldn't find anything that worked. It could possibly be jinja as well but im not sure.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134

1 Answers1

0

PackageLoader is defined as:

class jinja2.PackageLoader(package_name, package_path='templates', encoding='utf-8')

So the first argument should be a package name, not a path.

Check the Jinja2 documentation to better understand what you are supposed to supply for the package name.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134