I encountered an issue where my CSS isn’t loading. To troubleshoot, I tried running a previously working project created by my team, but I encountered the same problem. Even the Admin panel isn’t loading correctly. It’s an exact copy of the project, and I haven’t made any changes. I activated the Python virtual environment and installed all the necessary requirements.
Can someone help, please?
Welcome @anel777 !
You’ll need to provide more specific details about what’s happening.
I’m assuming you’re talking about a development environment using runserver and not a production deployment using a webserver and wsgi container?
- Is this with DEBUG=True or DEBUG=False?
Are you seeing requests for the CSS being issued by the browser?
Are you seeing responses from the server for those requests?
What operating system are you using?
What version of Python are you using?
What version of Django are you using?
Thank you, Ken, for getting back to me so quickly!
I’m indeed talking about a development environment using runserver
, and I have DEBUG = True
.
I am seeing the CSS requests with a status code 200 OK
both in my terminal and in the Network tab of the browser’s inspection tool.
Here are the details of my setup:
- OS: Windows 11
- Python: 3.11
- Django: I initially tried running it with version 5.1, then switched to 3, but neither worked. I’ve now reverted to the latest version.
Any help you could provide would be greatly appreciated!
I would first try using a full reload (shift f5) on the page, or try using an incognito page.
You can also try disabling the cache in the browser.
After trying one of these, if that hasn’t helped, please post the section of your runserver log showing all the requests for the page and all the related files.
Good morning,
Initially, the status code displayed is 305, but after performing a hard refresh (Ctrl + F5), it changes to 200. Below is the log from my runserver
:
Watching for file changes with StatReloader
[22/Aug/2024 10:37:17] "GET / HTTP/1.1" 200 77078
[22/Aug/2024 10:37:18] "GET / HTTP/1.1" 200 77078
[22/Aug/2024 10:37:18] "GET /static/css/vendors.min.css HTTP/1.1" 200 302968
[22/Aug/2024 10:37:18] "GET /static/css/icon.min.css HTTP/1.1" 200 309413
[22/Aug/2024 10:37:18] "GET /static/css/responsive.css HTTP/1.1" 200 415066
[22/Aug/2024 10:37:18] "GET /static/css/style.css HTTP/1.1" 200 447324
[22/Aug/2024 10:37:18] "GET /static/css/real-estate.css HTTP/1.1" 200 6119
[22/Aug/2024 10:37:18] "GET /static/js/jquery.js HTTP/1.1" 200 87604
[22/Aug/2024 10:37:18] "GET /static/images/logo/logo.png HTTP/1.1" 200 14048
[22/Aug/2024 10:37:18] "GET /static/images/icons/fabrication.png HTTP/1.1" 200 23573
[22/Aug/2024 10:37:18] "GET /static/images/about2.png HTTP/1.1" 200 358259
[22/Aug/2024 10:37:18] "GET /static/js/main.js HTTP/1.1" 200 180813
[22/Aug/2024 10:37:18] "GET /static/js/vendors.min.js HTTP/1.1" 200 521141
[22/Aug/2024 10:37:18] "GET /static/images/icons/surveillance.png HTTP/1.1" 200 26651
[22/Aug/2024 10:37:18] "GET /static/images/icons/marketing.png HTTP/1.1" 200 46295
[22/Aug/2024 10:37:18] "GET /static/images/icons/automation.png HTTP/1.1" 200 34674
[22/Aug/2024 10:37:18] "GET /static/images/icons/tracking.png HTTP/1.1" 200 16366
[22/Aug/2024 10:37:18] "GET /media/solutions/glass_work.jpg HTTP/1.1" 200 80240
[22/Aug/2024 10:37:18] "GET /static/images/home-banner3.jpg HTTP/1.1" 200 173386
[22/Aug/2024 10:37:18] "GET /static/images/expertise.jpg HTTP/1.1" 200 3604
[22/Aug/2024 10:37:18] "GET /media/solutions/construction.png HTTP/1.1" 200 585285
[22/Aug/2024 10:37:18] "GET /media/solutions/electrical.png HTTP/1.1" 200 574108
[22/Aug/2024 10:37:18] "GET /static/images/client.jpg HTTP/1.1" 200 3451
[22/Aug/2024 10:37:18] "GET /media/solutions/web_development.jpg HTTP/1.1" 200 53732
[22/Aug/2024 10:37:18] "GET /media/solutions/gps.jpg HTTP/1.1" 200 35817
[22/Aug/2024 10:37:18] "GET /static/images/why-choose.png HTTP/1.1" 200 894556
[22/Aug/2024 10:37:18] "GET /media/solutions/branding.jpg HTTP/1.1" 200 42815
[22/Aug/2024 10:37:18] "GET /media/solutions/Untitled_design.jpg HTTP/1.1" 200 40665
[22/Aug/2024 10:37:18] "GET /media/solutions/surveillance.jpg HTTP/1.1" 200 39818
[22/Aug/2024 10:37:18] "GET /media/solutions/iot.jpg HTTP/1.1" 200 24976
[22/Aug/2024 10:37:18] "GET /media/solutions/marketing.jpg HTTP/1.1" 200 52544
[22/Aug/2024 10:37:18] "GET /media/solutions/eas_antenna.jpg HTTP/1.1" 200 26304
[22/Aug/2024 10:37:18] "GET /media/solutions/intercom.jpg HTTP/1.1" 200 30154
[22/Aug/2024 10:37:18] "GET /media/solutions/barrier.jpg HTTP/1.1" 200 42007
[22/Aug/2024 10:37:18] "GET /media/solutions/pabx.jpg HTTP/1.1" 200 36607
[22/Aug/2024 10:37:18] "GET /media/solutions/turnstile.jpg HTTP/1.1" 200 47461
[22/Aug/2024 10:37:18] "GET /media/solutions/heat_mapping.jpg HTTP/1.1" 200 63436
[22/Aug/2024 10:37:18] "GET /static/images/icons/innovation2.png HTTP/1.1" 200 20287
[22/Aug/2024 10:37:18] "GET /static/images/icons/expertise.png HTTP/1.1" 200 19375
[22/Aug/2024 10:37:18] "GET /media/solutions/smart_door.png HTTP/1.1" 200 347440
[22/Aug/2024 10:37:18] "GET /static/images/icons/customization.png HTTP/1.1" 200 23667
[22/Aug/2024 10:37:18] "GET /static/images/icons/reliability.png HTTP/1.1" 200 22714
[22/Aug/2024 10:37:18] "GET /static/images/demo-real-estate-07.png HTTP/1.1" 200 2370
[22/Aug/2024 10:37:18] "GET /static/images/demo-real-estate-08.png HTTP/1.1" 200 3746
[22/Aug/2024 10:37:18] "GET /static/images/clients.png HTTP/1.1" 200 1138390
[22/Aug/2024 10:37:18] "GET /media/clients/RAY_INTERNATIONAL.jpg HTTP/1.1" 200 6246
[22/Aug/2024 10:37:18] "GET /media/clients/OSCO.jpg HTTP/1.1" 200 35365
[22/Aug/2024 10:37:18] "GET /media/clients/OMAN_AIR.png HTTP/1.1" 200 6343
[22/Aug/2024 10:37:18] "GET /media/clients/muscat.png HTTP/1.1" 200 5254
[22/Aug/2024 10:37:18] "GET /media/clients/MINISTRY_OF_HIGHER_EDUCATION.png HTTP/1.1" 200 13037
[22/Aug/2024 10:37:18] "GET /media/clients/MINISTRY_OF_DEFENSE.jpg HTTP/1.1" 200 19000
[22/Aug/2024 10:37:18] "GET /media/clients/MB_PETROLEUM.png HTTP/1.1" 200 32199
[22/Aug/2024 10:37:18] "GET /media/clients/duqm.jpg HTTP/1.1" 200 7529
[22/Aug/2024 10:37:18] "GET /media/clients/jotun.jpg HTTP/1.1" 200 33064
[22/Aug/2024 10:37:18] "GET /media/clients/MAJID.png HTTP/1.1" 200 60722
[22/Aug/2024 10:37:18] "GET /media/clients/DIWAN.jpg HTTP/1.1" 200 14959
[22/Aug/2024 10:37:18] "GET /media/clients/ALMOUJ.png HTTP/1.1" 200 3037
[22/Aug/2024 10:37:18] "GET /media/clients/ALNABA.jpg HTTP/1.1" 200 8902
[22/Aug/2024 10:37:18] "GET /media/clients/ALHAJRY.jpg HTTP/1.1" 200 7946
[22/Aug/2024 10:37:18] "GET /media/clients/ALFARDAN.jpg HTTP/1.1" 200 5185
[22/Aug/2024 10:37:18] "GET /media/clients/ABRAJ.jpg HTTP/1.1" 200 7293
[22/Aug/2024 10:37:18] "GET /static/images/home-banner2.jpg HTTP/1.1" 200 163091
[22/Aug/2024 10:37:18] "GET /static/images/home-banner1.png HTTP/1.1" 200 2834546
[22/Aug/2024 10:37:18] "GET /static/images/logo/favicon.ico HTTP/1.1" 200 15406
Performing system checks...
System check identified no issues (0 silenced).
August 22, 2024 - 10:37:13
Django version 5.1, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
The log you show above appears to be a get for the root url
Is this image the page for that view?
If so, please show the template being rendered. (Note, also include any base templates if you’re extending a base.)
If you look at the Sources tab in the Developer tools for those css files, do you see the expected contents?