-1

I have managed to upload my django project to a server(www.sb10-89.co.uk but the css file isn’t working. Even the admin page doesn't look right, again i guess its missing a css page.

The code below is from my settings file.

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATIC_URL = 'staticfiles/bands_ratings'

See below image for file structure. file directory

Connecting css in html

  <link rel="stylesheet" href="{% static 'Style.css' %}" >

Project level urls file code

from django.contrib import admin
from django.urls import path , include
from django.views.generic import RedirectView
from django.contrib.auth.views import LogoutView


urlpatterns = [
    path("admin/", admin.site.urls),
    path('bands_ratings/', include ('bands_ratings.urls')),
    path('',RedirectView.as_view(url='bands_ratings/signup/')),        
    path('accounts/', include('django.contrib.auth.urls'))
]
#urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Ivan Starostin
  • 8,798
  • 5
  • 21
  • 39
Wishmaster
  • 23
  • 1
  • 6

1 Answers1

0

You should run manage.py collectstatic when going into production (strictly after setting DEBUG-FALSE).

https://docs.djangoproject.com/en/4.2/howto/static-files/deployment/