7
Can you import elementtree
within the django shell:
python manage.py shell
Assuming you have multiple python versions and do not know which one is being used to run your site, add the following to your view and push python_ver
to your template, it will show you the Python version you are using:
import sys
python_ver = sys.version
You can also explicitly add the path to elementtree programatically in your settings.py
:
import sys
sys.path.append('path to where elementtree resides')
1
I’ve also run into cross-platform issues where ElementTree was available from different modules on different systems… this ended up working for me:
try:
import elementtree.ElementTree as ET
except:
import xml.etree.ElementTree as ET
May or may not help for you…
- [Django]-How to include "None" in lte/gte comparisons?
- [Django]-Django: m2m_changed not fired when end of relation is deleted
- [Django]-Django Allauth Ignoring Adapter
0
Go into your installation directory
Example:
C:\Python26\Lib\site-packages
And check if both elementtree and django are in there.
If they are both not there, then you probably have multiple installation directories for different versions of Python.
In any case, you can solve your problem by running this command:
python setup.py install
Run it twice, once inside the download for django and once inside the download for elementtree. It will install both of the downloads into whatever your current default python is.
References:
- [Django]-Setting up Apache and Python WSGI to use VirtualEnv
- [Django]-What's the equivalent of Rails' Migrations or Django's South in Pylons and TG2?
- [Django]-Query on manyToMany field with related_name
- [Django]-Django CreateView filter foreign key in select field