lundi 7 juillet 2014

Django upgrade, Import Error and conflicting package names


Vote count:

0




I have an older django project (created while 1.3 was hot) which I'm attempting to convert to the latest Django 1.6.


The new directory strucure was converted to the new way, and the project name was removed from all imports (from myproject.api import x became from api import x)


myproject/ myproject/ __init__.py settings.py urls.py api/ __init__.py resthandler.py platforms/ __init__.py plat1/ __init__.py handlers.py api/ __init__.py


The problem is that platforms/plat1/handlers attempts to import from /api/resthandler.py


from api.resthandler import RestHandler


But as there is already an api at a lower level, it fails with an ImportError as resthandler is not there, its 2 levels up and one down in /api. I've tried returning the project level to imports, tried relative imports, nothing helps. I can't seem to import /api from within platforms/plat1/. I'd go and change the entire structure but I wanted to see if I'm missing something before I take that route.



asked 1 min ago

Harel

405





Aucun commentaire:

Enregistrer un commentaire