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

232
Visualizações
JavaScript (React) component imports from a Python (Django app) package

I have created a Django project with a React front-end. I'd like to reuse some of the Django apps and their corresponding React components, so I moved them to a separate Python package following the Django docs: Advanced tutorial: How to write reusable apps. The React components are in the static folders for each Django app and are included with the Python package.

The problem I'm running into is that after this new Python package is built and installed in a new Django project, to import a React component I have to import it from the Python package directory (site-packages). Is there a cleaner way to import the React components other than like this?

import Comp1A from 'venv/lib/python3.10/site-packages/app_pkg/app1/static/app1/js/comp1a';

This is problematic since the location of site-packages can vary from project to project. Is there at least a dynamic way to generate this path? I can use module.exports.resolve.alias in my webpack.config.js to only set it once in the project, but I would, at least, like to be able to generate the alias automatically.

about 4 years ago · Juan Pablo Isaza
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