django 정적 경로 설정

537 단어 django
1. settings.py
import os



ROOT_PATH = os.path.dirname(os.path.abspath(__file__))



...



STATIC_PATH = os.path.join(ROOT_PATH,'content').replace('\\','/')

STATIC_URL = '/content/'



...

...


2. urls.py
from django.conf import settings



...





urlpatterns = patterns('',

    ...

    (r'^content/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.STATIC_PATH})

    ...

)


좋은 웹페이지 즐겨찾기