ImportError: Import by filename is not supported. (WSGI)
<p>I don't now why I seem to be getting the following errors from the Apache24 error log: </p>

<pre><code>    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.
</code></pre>

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

<pre><code>    import cgi, urlparse, jinja2, os
    from pymongo import MongoClient
    from sets import Set
    from jinja2 import Environment, PackageLoader
</code></pre>

<p>and the actual code where I believe the issue may lie is:</p>

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

<p>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.</p>

<p><code>PackageLoader</code> is defined as:</p>

<blockquote>
  <p>class jinja2.PackageLoader(package_name, package_path='templates', encoding='utf-8')</p>
</blockquote>

<p>So the first argument should be a package name, not a path.</p>

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

<ul>
<li><a href="http://jinja.pocoo.org/docs/dev/api/#jinja2.PackageLoader" rel="nofollow">http://jinja.pocoo.org/docs/dev/api/#jinja2.PackageLoader</a></li>
</ul>

python jinja2 mod-wsgi