Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
Python/Django "Import Error" in project directory

I've been having troubles with this and cannot find the solution... I've browsed all SO questions about this but nothing worked in my case... So here's the problem:

  1. I clone a project from git repository
  2. Set up a virtualenv called env in project base dir with proper Python version(2.7) & install all reqs succesfully
  3. Here's where it gets fun... I navigate to the folder that has my manage.py and do a python manage.py makemigrations which results in

from foo.bar.data import CoolioClass

ImportError: No module named foo.bar.data

My directories look like this (just for illustration):

project_root/
     ├──env/
     ├──django/
     │      ├── app
     │      │   └── models.py (from foo.bar.data import CoolioClass)
     │      ├── django
     │      │   └── settings.py
     │      └── manage.py
     └──foo/
        ├── bar
        │   ├── __init__.py
        │   ├── data.py
        │   └── test.py
        ├── baz
        │   ├── __init__.py
        │   ├── data.py
        │   └── test.py
        └── __init__.py

When I print sys.path in python shell it results in:

/home/johnny/project_root/env/lib/python2.7
/home/johnny/project_root/env/lib/python2.7/plat-x86_64-linux-gnu
/home/johnny/project_root/env/lib/python2.7/lib-tk
/home/johnny/project_root/env/lib/python2.7/lib-old
/home/johnny/project_root/env/lib/python2.7/lib-dynload
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/home/johnny/project_root/env/local/lib/python2.7/site-packages
/home/johnny/project_root/env/lib/python2.7/site-packages
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda