1

Can I run Django's internal server for testing with Jython?

I've installed django-jython, but I get this message when I try to run the server:

jython manage.py runserver 8000

Traceback (most recent call last): File "manage.py", line 2, in <module>
from django.core.management import execute_manager 
ImportError: No module named django
3
  • What version of Jython ? In which directory is Django-jython installed ? Commented Mar 2, 2012 at 13:44
  • It's ok it contains "/Users/cassiomelo/code/jython/Lib/site-packages" where "django_jython-1.3.0b2-py2.5.egg-info" is Commented Mar 2, 2012 at 13:50
  • @jpic : 1.3.0b2 and /Users/cassiomelo/code/jython/Lib/site-packages Commented Mar 2, 2012 at 13:51

1 Answer 1

1

This means that Jython cannot find the 'django' module. Here, the first thing Jython is going to do is try to find the django module:

from django.core.management import execute_manager

It fails, and throws ImportError: No module named django.

You should find out where your django module is, it should be a directory named 'django' that contains an __init__.py file.

Set your python path for jython to the parent directory. For example, if you find /Users/cassiomelo/code/jython/Lib/site-packages/django/__init__.py, then you should add /Users/cassiomelo/code/jython/Lib/site-packages to the python path. Click the link to see how to set it depending on your Jython version.

The next time Jython will try to import the 'django' module, it will look in the directory of the python path if there is a directory named 'django' with an __init__.py in it and proceed to importing the core submodule, then management, then execute_manager.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.