stkr
stkr
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
I tried also with nginx with this config:
server {
listen 80;

server_name depistclic-production.up.railway.app;

location / {
proxy_pass http://web:${PORT};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}

location = /favicon.ico { access_log off; log_not_found off; }

location /uploads/ {
alias /app/DepistClic/uploads;
}
}
server {
listen 80;

server_name depistclic-production.up.railway.app;

location / {
proxy_pass http://web:${PORT};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}

location = /favicon.ico { access_log off; log_not_found off; }

location /uploads/ {
alias /app/DepistClic/uploads;
}
}
` Stilll not working. Could anyone say how people manage media files in production in Django app ? Thanks
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
Maybe add os.path.join(BASE_DIR, "uploads") to the STATICFILES_DIRS...
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
I tried with and without first slashes both static and media, and for each case I tried the mount path /app/uploads and /app/DepistClic/uploads. Nothing works, not any media file is accessible through urls of type https://depistclic-production.up.railway.app/uploads/ordonnances/file.pdf. The files are on the mounted volume, I checked it through ls -la in entrypoint.sh. Mystery. Tomorrow I'll try again with nginx I guess, maybe it could serve these files
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
this is from the access logging: 192.168.0.3 - - [08/Nov/2023:21:12:49 +0000] "GET /uploads/ordonnances/Bilan_annuel_4EjwBX7.pdf HTTP/1.1" 404 179 "https://depistclic-production.up.railway.app/synthese/";
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
Thank you guys both of you
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
But I don't want to give app
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
So frustrating...
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
The requested resource was not found on this server.
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
No description
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
i mean all the requests
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
Is it possible to visualise somewhere server logs on railway, like whith the development server ?
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
yes it has slightly increased. So I guess the files are there. I've added all files manually through the admin panel, and now redeploying and crossing fingers
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
ok, and how I could know if it's effectively stored on the monted volume ?
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
just a question, is it normal that I cannot find the uploads folder while I'm in the railway shell ?
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
yes thanks a lot anyway, for the hour you've spent helping me on that. I really appreciate that
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
now I just have to put the files there right ?
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
it seem have changed from media to uploads
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
ok the deploy log is happier:
Operations to perform: Apply all migrations: admin, auth, contenttypes, mainapp, sessions Running migrations: No migrations to apply. 130 static files copied to '/app/DepistClic/staticfiles'. [2023-11-08 20:24:16 +0000] [37] [INFO] Starting gunicorn 21.2.0 [2023-11-08 20:24:16 +0000] [37] [INFO] Listening at: http://0.0.0.0:6789 (37) [2023-11-08 20:24:16 +0000] [37] [INFO] Using worker: sync [2023-11-08 20:24:16 +0000] [39] [INFO] Booting worker with pid: 39
75 replies
RRailway
Created by stkr on 11/8/2023 in #✋|help
How to serve media files in Django app on Railway ? Nginx ? Please help
It's nothing to do with the database ? Is it ? Just to make sure that it's not a problem with the imageField link pointing to the file
75 replies