i'm trying follow these instructions enable static files in django project. have
static_url = '/static/' in settings.py file. have 'django.contrib.staticfiles', added installed_apps = (...) part created folder mysite/static/mysite , put files there. after run server, cannot access files @ http://127.0.0.1:8000/static/mysite/style.css. have done wrong?
in settings.py include this:
import os settings_dir = os.path.dirname(__file__) project_root = os.path.abspath(os.path.dirname(settings_dir)) staticfiles_dirs = ( os.path.join(project_root, 'static/mysite/'), ) and in urls.py include these lines @ end:
from django.conf.urls.static import static django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns() hope helps.
Comments
Post a Comment