Hello Everyone!
I recently deployed a Django Application following the known tutorials and I’m managing static files with WhiteNoise.
The problem I have is that when I access the application, the static files are sometimes being served and sometimes they are not:
Looking at the logs I have:
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]ERROR No such file or directory (os error 2)
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]ERROR No such file or directory (os error 2)
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]ERROR No such file or directory (os error 2)
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]Not Found: /static/js/modal.js
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]Not Found: /static/js/tts.js
2023-06-21T08:58:48Z app[e784e903f00118] ams [info]Not Found: /static/js/htmx.min.js
2023-06-21T08:58:51Z app[e784e903f00118] ams [info]ERROR No such file or directory (os error 2)
2023-06-21T08:58:51Z app[e784e903f00118] ams [info]Not Found: /static/css/normalize.css
2023-06-21T08:58:51Z app[e784e903f00118] ams [info]ERROR No such file or directory (os error 2)
2023-06-21T08:58:51Z app[e784e903f00118] ams [info]Not Found: /static/js/modal.js
This happened both when using volumes
or not. Currently I’m not using them and I’m just collecting statics after deploying.
My fly.toml
:
# fly.toml app configuration file generated for findyourfind on 2023-06-06T13:15:59+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = "findyourfind"
primary_region = "ams"
console_command = "/code/manage.py shell"
[deploy]
release_command = "python manage.py migrate"
[env]
PORT = "8000"
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = false
auto_start_machines = false
min_machines_running = 0
[[statics]]
guest_path = "/code/staticfiles"
url_prefix = "/static"
Any ideas or suggestions?