wger-project / docker

Production...ish docker-compose image for wger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wgner do not load CSS and exercises at all

matijastampfel opened this issue · comments

commented

When I load home page there is no CSS or pictures at all.

Console:

GET http://192.168.1.248:8005/static/CACHE/css/output.bb29faf5c6cc.css net::ERR_ABORTED 404 (Not Found)
features:55 GET http://192.168.1.248:8005/static/CACHE/js/output.47a47acd93ca.js net::ERR_ABORTED 404 (Not Found)
features:329 GET http://192.168.1.248:8005/static/yarn/shariff/dist/shariff.min.js net::ERR_ABORTED 404 (Not Found)
features:158 GET http://192.168.1.248:8005/static/images/weight-chart.png 404 (Not Found)
features:173 GET http://192.168.1.248:8005/static/images/calendar.png 404 (Not Found)
features:218 GET http://192.168.1.248:8005/static/images/rest-api.png 404 (Not Found)
features:203 GET http://192.168.1.248:8005/static/images/gym-management.png 404 (Not Found)
features:188 GET http://192.168.1.248:8005/static/images/muscle-overview.png 404 (Not Found)
favicon.png:1 GET http://192.168.1.248:8005/static/images/favicon.png 404 (Not Found)

Please help

Hi! Mhhh this is strange, did you change something in the config or compose file? If not, could you delete the volumes and start the containers again?

commented

I did only 2 things add
ports:
- "8005:8000"

And
networks:
default:
name: wger_network
driver: bridge
ipam:
config:
- subnet: 172.62.57.0/24

If you want to change the port you need to change the nginx port in line 40 (the static files are served by it, otherwise you are accessing the application directly and all the css files are missing)

commented

To which port should I change ?

if you want to access the application over 8005, then simply to "8005:80"

commented

ERROR: for wger_nginx Cannot start service nginx: driver failed programming external connectivity on endpoint wger_nginx (d2150f3fbc42999da1b1a34458871caca4fa21113d3c282636ffddad5988a955): Bind for 0.0.0.0:8005 failed: port is already allocated

ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint wger_nginx (d2150f3fbc42999da1b1a34458871caca4fa21113d3c282636ffddad5988a955): Bind for 0.0.0.0:8005 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

commented

I did remove all volumes before

🤨🤨🤨

Is that port already used by something else in your network? Can you change it to something else?

commented

nginx:
image: nginx:stable
container_name: wger_nginx
depends_on:
- web
volumes:
- ./config/nginx.conf:/etc/nginx/conf.d/default.conf
- static:/wger/static:ro
- media:/wger/media:ro
ports:
- "8007:80"
healthcheck:
test: service nginx status
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped

commented

I change it to 8007

I am getting same issue

Should I change in nginx:

upstream wger {
server web:8000;
}

?

no, just the one line in nginx is enough. I honestly don't know what else to try, it just seems there is something else blocking the port

So I am running into the same error. I am running a docker image on an unraid setup. I get the following after a successful startup:

Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
[25/Sep/2022 21:05:57] "GET / HTTP/1.1" 302 0
[25/Sep/2022 21:05:57] "GET /en/ HTTP/1.1" 302 0
[25/Sep/2022 21:05:57] "GET /en/software/features HTTP/1.1" 200 14872
[25/Sep/2022 21:05:57] "GET /static/CACHE/css/output.10d45dee13d8.css HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/CACHE/js/output.47a47acd93ca.js HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/yarn/shariff/dist/shariff.min.js HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/images/weight-chart.png HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/images/calendar.png HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/images/muscle-overview.png HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/images/rest-api.png HTTP/1.1" 404 2762
[25/Sep/2022 21:05:57] "GET /static/images/gym-management.png HTTP/1.1" 404 2762
[25/Sep/2022 21:05:58] "GET /static/images/favicon.png HTTP/1.1" 404 2762

All I have changed from the original config is the port at which is access' it over

commented

@rolandgeider any news regarding this issue ?

commented

Having the same issue

Hi, I have the same Issue. No Pictures at all. Does someone solved this?

commented

Hi,

sometimes it is helpful to know the following general overview on how django works.

Running Django in "development" mode will serve the static (js, css, ...) files and the media (images, ...) files directly from the source code and serve on the port django runs. But this is not the case for a productive environment.

In the productive mode, starting up django will copy all needed (changed) static files to the defined storage (volumes) and only serve the rendered pages. The django port is not ment to be access directly from the user, but from a webserver (proxy).

The user accesses trough a webserver like nginx, this is the only Port the users must have access to. As for nginx it will serve basically two things:

  • Proxy to the django port for serving the rendered webpages
  • Serve the static and media files directly from the filesystem

So Users -> Nginx Port -> Django Port and Users -> Nginx Port -> Filesystem needs to work to serve the pages.

  • nginx and django both needs access to the static and media volumes
  • nginx needs access to the port django runs on
  • django needs to be in productive mode

I hope this helps...