当我尝试访问我的服务器的任何页面时,Django在urls.py第93行抛出异常,虽然该行为空,但我无法在附近找到任何缩进错误。
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
89. response = middleware_method(request)
File "/usr/local/lib/python2.7/dist-packages/django/middleware/common.py" in process_request
67. if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in is_valid_path
555. resolve(path, urlconf)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
444. return get_resolver(urlconf).resolve(path)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
317. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns
347. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module
342. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/var/www/streambed/shelly/shelly/urls.py" in <module>
133. (r'', include('api_docs.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include
24. urlconf_module = import_module(urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
35. __import__(name)
Exception Type: IndentationError at /plot
Exception Value: unexpected indent (urls.py, line 93)
这是urls.py的样子:
第83行:
urlpatterns = patterns(
r'',
url(r'', include('webapp.urls', namespace='feed')),
.....
第91/92行:
url(r'^~(?P<username>[-A-Za-z0-9_.]+)/(?P<plot_id>\d+)/(?P<title>[A-Za-z0'
'-9\-]+)/$', 'webapp.views.feed.index', name="shareplot"),
第93行是空的
第94行:
url(r'^~(?P<username>[-A-Za-z0-9_.]+)/(?P<plot_id>\d+)/?\.embed$',
inplot.as_view(), name="inplot"),
url(r'^~(?P<username>[-A-Za-z0-9_.]+)/(?P<plot_id>\d+)/(?P<title>[\w\-]+)'
'?\.embed$', inplot.as_view(), name="inplot"),
答案 0 :(得分:0)
基本上,缩进错误是在另一个模块的urls.py中,而不是我正在调查的主文件。