Importing django modules from java
Question: I am trying to call some classes from my django project using Java. Here is my
code:

    
    
    PythonInterpreter interpreter = new PythonInterpreter();
    
            PySystemState sys = Py.getSystemState(); 
    
    
            sys.path.append(new PyString("/Library/Python/2.7/site-packages/"));
            sys.path.append(new PyString("/myApps/categoryApp/review/"));
    
            interpreter.exec("from products.models import Category");
    

But I got this error:

    
    
    Exception in thread "main" Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/myApps/categoryApp/review/products/models.py", line 4, in <module>
        from django.core.exceptions import ValidationError
      File "/Library/Python/2.7/site-packages/django/core/exceptions.py", line 4, in <module>
        from functools import reduce
    ImportError: cannot import name reduce
    

Any idea solving it? I believe there is something wrong with the imports


Answer: The standard version of Jython is compatible with Python 2.5. As described in
the [documentation on running Django on
Jython](https://docs.djangoproject.com/en/1.5/howto/jython/), Django 1.5 only
compatible in Python 2.6 upwards. You will need to run the 2.7 beta version of
Jython, or the older 1.4 version of Django.

