Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange staticfiles behaviour #765

Closed
kousu opened this issue Jun 27, 2017 · 4 comments
Closed

Strange staticfiles behaviour #765

kousu opened this issue Jun 27, 2017 · 4 comments

Comments

@kousu
Copy link

kousu commented Jun 27, 2017

I just tried putting sous-chef up again using docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d, which runs /bin/bash -c "cd tools/gulp && npm install && gulp && cd ../../src && python manage.py collectstatic --noinput && /usr/local/bin/gunicorn sous_chef.wsgi:application -w 2 -b :8000. Strangely, this did not create the staticfiles properly; for example http://localhost:8000/static/images/logo-souschef-coul.png was 404'ing.

I re-ran docker-compose exec web "cd tools/gulp && npm install && gulp" and then it worked.

There are three copies of the static files:

root@a375081c9a66:/code# find -name logo-souschef-coul.png
./src/frontend/images/logo-souschef-coul.png
./src/static/images/logo-souschef-coul.png
./src/sous_chef/static/images/logo-souschef-coul.png

I think, but haven't fully tested yet, that src/frontend is the source folder, src/static is made by collectstatic, and src/sous_chef/static/ is made by gulp and is the one generated by gulp, and furthermore perhaps collectstatic is erasing it, which means gulp && cd ../../src && python manage.py collectstatic --noinput should rather be python manage.py collectstatic --noinput && cd ../tools/gulp && gulp or maybe even just gulp.

Does anyone know what's going on here? The behaviour is very inconsistent and confusing.

@lingxiaoyang
Copy link
Contributor

@kousu I never looked at collectstatic but I doubt if it still works as we have been using gulp for quite a while. I'll let you know.

@kousu
Copy link
Author

kousu commented Jun 27, 2017

Thanks @lingxiaoyang; I think it should be perfectly reproducible if you start from a fresh checkout and run with the production settings

git clone https://github.com/savoirfairelinux/sous-chef/ sous-chef-prodtest
cd sous-chef-prodtest
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up

@erozqba
Copy link
Contributor

erozqba commented Jul 1, 2017

@kousu yes, we have a bug there! I will look into it.

@erozqba
Copy link
Contributor

erozqba commented Jul 11, 2017

@kousu this bug has been fixed in PR #775
You could check it from a fresh checkout using this commands:

git clone https://github.com/savoirfairelinux/sous-chef/ sous-chef-prodtest
cd sous-chef-prodtest
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
docker-compose exec web sh -c "python src/manage.py migrate"
docker-compose exec web sh -c "python src/manage.py createsuperuser"
docker-compose exec web sh -c "python src/manage.py loaddata sample_data"

Then add the hostname "souschef.santropolroulant.org" in your /etc/hosts
127.0.0.1 souschef.santropolroulant.org
And check it out in a browser http://souschef.santropolroulant.org/

Note: The Hostname http://souschef.santropolroulant.org/ could be changed in the docker-compose.prod.yml

I'm closing this issue, you could reopen it if you find any problems.

@erozqba erozqba closed this as completed Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants