0

I was working with Django latest version by watching a tutorial on YT, but for some reason, my admin page isn't coming how it has to. It does not have a style or CSS.

[enter image description here][1]

[1]: https://i.sstatic.net/MrASY.pngenter code here

1
  • 4
    have you tried python manage.py collectstatic? Commented Mar 30, 2020 at 18:06

2 Answers 2

1

Are you running in debug or production mode?

Django delivers static files like CSS, JS etc in debug though it's own development server. When you run in production mode / through a web server you have to configure your web server to deliver the static files.

Cheers

Sign up to request clarification or add additional context in comments.

1 Comment

Right now I am in debug mode as I have just started using it.
0

First of all I think you should first try this in the command line:

python manage.py collectstatic

After that go to settings file and check STATIC_URL and STATIC_ROOT

It should look like this(if you didn't change anything):

STATIC_URL = '/static/' STATIC_ROOT = "/var/www/example.com/static/"

Static Url: URL to use when referring to static files located in STATIC_ROOT.

Static Root: The absolute path to the directory where collectstatic will collect static files for deployment.

and also you can check the documentation.

2 Comments

Are you using Nginx?
@Aman Sharma check the browsers network monitor. It'll show you which resources are requested and from where.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.