I am trying to setup a static url in Django and have my templates use it to link to the css. Here is my code. Why is it not working? Also, what is the best practice for setting this up? Thanks.
# settings
import os
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
INSTALLED_APPS = (
...
'django.contrib.staticfiles',
)
# urls
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# ... the rest of my URLconfs here ...
urlpatterns += staticfiles_urlpatterns()
# html template
<link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" type="text/css">
# file structure
-project
--project
---settings
---static
----css
-----style.css