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

196
Visualizações
MIME type ('text/html') is not a supported stylesheet MIME type with react-django heroku deploy

I've been getting the error "MIME type ('text/html') is not a supported stylesheet MIME type" on my django+react deploy on Heroku. This is mostly because django can't find the staticfiles from react.

Setting staticfiles dir in settings.py should have solved the problem, but it didn't:

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'build/static'),
)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I decided to create this question with self answer because I spend a very long and frustrating afternoon solving this issue since I didn't find the right solution anywhere on the web.

What I did wrong in my deployment was setting my buildpacks the wrong way when I set up the project for heroku. Don't be me and immediately go to StackOverflow and find the solution there.

To serve the staticfiles correctly obviously python and collectstatic has to run after npm build from react. Thus add python buildpack after nodejs in Heroku:

heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/python
about 4 years ago · Juan Pablo Isaza Relatório
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