Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用StaticGenerator从Django项目生成静态HTML_Python_Html_Django_Static - Fatal编程技术网

Python 使用StaticGenerator从Django项目生成静态HTML

Python 使用StaticGenerator从Django项目生成静态HTML,python,html,django,static,Python,Html,Django,Static,我正在尝试为我在Django中构建的站点生成静态HTML。到目前为止我想到的是。在我看来,它应该类似于github页面中的示例,但我已经编写了下面的代码,它给出了下面的错误 代码: 错误(为简洁起见进行了编辑): 好的,在查看您的跟踪后,我将猜测您的设置。WEB\u ROOT是一个元组 相关线路: # web root set self.web_root = getattr(self.settings, 'WEB_ROOT') # web root used filename = self.

我正在尝试为我在Django中构建的站点生成静态HTML。到目前为止我想到的是。在我看来,它应该类似于github页面中的示例,但我已经编写了下面的代码,它给出了下面的错误

代码:

错误(为简洁起见进行了编辑):


好的,在查看您的跟踪后,我将猜测您的
设置。WEB\u ROOT
是一个元组

相关线路:

# web root set
self.web_root = getattr(self.settings, 'WEB_ROOT')

# web root used 
filename = self.fs.join(self.web_root, path.lstrip('/')).encode('utf-8')

# breaks on real os.path.join
return os.path.join(paths[0], *[path.lstrip("/") for path in paths[1:]])

哇,那是个愚蠢的错误。我让WEB_根在末尾用逗号书写。我总是被标点符号绊倒。:-)非常感谢。我希望我能投你一票,但是声誉系统把我拒之门外。太棒了!很高兴你发现了问题。附言:嘘。甚至不能接受?我想知道是不是因为我在某一点上删除了这篇文章。谢谢:)那么它在upvote上说了什么?在这一点上我只是好奇,因为我从来没有被阻止投票。投票需要15%的声誉
Traceback (most recent call last):
    quick_publish('/')
  File "/usr/local/lib/python2.6/dist-packages/staticgenerator/__init__.py", line 232, in quick_publish
    return StaticGenerator(*resources).publish()
  File "/dist-packages/staticgenerator/__init__.py", line 229, in publish
    return self.do_all(self.publish_from_path)
  File "/dist-packages/staticgenerator/__init__.py", line 223, in do_all
    return [func(path) for path in self.resources]
  File "/dist-packages/staticgenerator/__init__.py", line 187, in publish_from_path
    filename, directory = self.get_filename_from_path(path)
  File "/dist-packages/staticgenerator/__init__.py", line 179, in get_filename_from_path
    filename = self.fs.join(self.web_root, path.lstrip('/')).encode('utf-8')
  File "/dist-packages/staticgenerator/filesystem.py", line 38, in join
    return os.path.join(paths[0], *[path.lstrip("/") for path in paths[1:]])
  File "/usr/lib/python2.6/posixpath.py", line 67, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'tuple' object has no attribute 'endswith'
# web root set
self.web_root = getattr(self.settings, 'WEB_ROOT')

# web root used 
filename = self.fs.join(self.web_root, path.lstrip('/')).encode('utf-8')

# breaks on real os.path.join
return os.path.join(paths[0], *[path.lstrip("/") for path in paths[1:]])