Here is my settings.py
# ...other settings
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = 'static/'
# ...other settings
Then I run
python manage.py collectstatic
uvicorn Django_Channels.asgi:application --port 8000 --workers 4 --log-level debug --reload
this collects static (after that I do have static folder at the root folder), starts the asgi server, but when I go to the admin page it looks like without any CSS or JS files. Just a bunch of unorganised text.
Here are the logs from terminal:
Here what logs look likeINFO:
127.0.0.1:51770 - "GET /static/admin/css/dashboard.css HTTP/1.1" 404 Not Found
Not Found: /static/admin/css/responsive.css
INFO: 127.0.0.1:51770 - "GET /static/admin/css/responsive.css HTTP/1.1" 404 Not Found
Not Found: /static/admin/js/theme.js
INFO: 127.0.0.1:51769 - "GET /static/admin/js/theme.js HTTP/1.1" 404 Not Found
Not Found: /static/admin/js/nav_sidebar.js
INFO: 127.0.0.1:51770 - "GET /static/admin/js/nav_sidebar.js HTTP/1.1" 404 Not Found
I am always having a bad time with staticfiles, could please somebody tell me what am I doing wrong?
As you can see in related questions and in the django docs, static files can be served when you set
DEBUG=True
(for your development purposes only). Otherwise you have to include the static files path into your web server configuration.