0
votes

So I upload my site to digitalocean and when I went to the admin page the CSS was not showing

I visit all these sites but nothing seems to work

Django doc-static files

Pythonanywhere-DjangoStaticFiles

StackOverflow -why my django admin site does not have the css style

I set up my STATIC_ROOT and STATIC_URL, and then I ran

python manage.py collectstatic

And here is my seting

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,  '/home/django/django_project/django_project/static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static/'), 
]
2
How have you deployed it? Have you made sure your nginx/apache is configured to serve your static files?Jon Clements
You were right there was a problem in my configuration file, Thanks @JonClementswaleed

2 Answers

0
votes

You are specifying an Absolute Path for your join.

os.path.join(BASE_DIR, arg2) means join the current directory that is being executed and append the second argument.

0
votes

add these lines into your settings.py file

STATICFILES_DIRS = (                                                            
 os.path.join(BASE_DIR, 'static/'),                                          
 )