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

238
Visualizações
django collectstatic picking files from wrong location

I am beginner in Python and Django. I am using Windows10 and I have installed Python 3.10.0 and pip 21.3.1. I installed Django using following commands

pip install virtualenvwrapper-win
mkvirtualenv firstdjango
pip install django
django-admin startproject demo

then I created APP for just simple static HTML page and now I am trying to use static files. I created a folder having name "static" on root and placed all css, js etc files in it and in settings.py, I mentioned following.

STATIC_URL = '/static/'
STATICFILES_DIR = [
    os.path.join(BASE_DIR, 'static')
]
STATIC_ROOT = os.path.join(BASE_DIR,'assets')

Now when I hit

python manage.py collectstatic

then it is not copying, what is in my static folder to assests folder.

When I tried to check from where collectstatic is trying to copy using following command

python manage.py findstatic -v 3 dummy

then I got following

C:\Users\dell\Envs\firstdjango\lib\site-packages\django\contrib\admin\static

but my project location is E:\django\demo

I am not getting, why collectstatic is not able to copy correct files and hence I do not get correct paths of my css, js and images in my web page.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I suspect that your virutalenv and your project aren't in the same location

you can try the following method :

pip install virtualenv  // install virtualenv
virtualenv env          //create your virutalenv
\pathto\env\Scripts\activate // activate your virtualenv

pip install django  
django-admin startproject demo
cd demo

And then collect your statifiles

over 4 years ago · Santiago Trujillo 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