I just added a css file for my Django-powered page. But I'm getting the error message:
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
101. request.path_info)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
298. for pattern in self.url_patterns:
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in url_patterns
328. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
323. self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name)
File "C:\Python27\PythonProjects\testproject\testproject\urls.py" in <module>
25. (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': site_media}),
Exception Type: TypeError at /
Exception Value: 'tuple' object is not callable
On my urls.py file I have included the following lines:
site_media = os.path.join(os.path.dirname(__file__), 'site_media')
urlpatterns = patterns('',
..................
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': site_media}),
)
The error message tells me that the error is coming from the last mapping in the urlpatterns
. I have my site_media
folder stored in C:/Python27/PythonProjects/testproject
, and my css file is inside the site_media
folder. Thanks!
您可能在上一行的末尾缺少逗号。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.