我正在尝试使用 django 使用feedgenerator.Rss201rev2Feed创建播客 rss 提要 作为提要生成器,它的工作方式与 BeautifulSoup 有点相反:将信息放入适当的 xml 标签中
它运行良好,但我不想转义所有html
特别是,我希望<itunes:summary>
rss feed 的值显示如下:
<itunes:summary><![CDATA[Link to <a href="http://www.website.com">the website</a>]]></itunes:summary>
按照Apple 规范
如果我在普通视图中渲染 html,我可以在 html 模板中使用|safe
过滤器。我现在需要类似的东西,以有选择地防止<
在 rss feed 中转义。
也就是说,我需要 rss 出现<![CDATA[...]]
而不是转义<![CDATA[...]]>
然而,Django似乎“无论如何,Django都会自动转义RSS提要(或任何与此相关的XML)中的特殊字符,无论您是否通过安全过滤器传递它”(请参阅this 2009 Question)
到目前为止还没有运气:
因此,迄今为止使用mark_safe 的尝试已被证明是无用的。
我也不确定如何解释一种想法,将“autoescape=False 传递给 django.contrib.synmination.feeds 中的 render() 调用”。
添加到 addQuickElement 注释的建议, escape=False
返回了错误
handler.addQuickElement(u'itunes:summary',item['summary'], escape=False)
TypeError: addQuickElement() got an unexpected keyword argument 'escape' …
Run Code Online (Sandbox Code Playgroud) 通过homebrew安装后我遇到了postgresql的困难.我在Mac OS X 10.9.5上(今天刚刚更新并重启).
注意我没有故意通过自制软件从默认的postgresql安装中更改任何内容
问题
任何这些都是成功的
我花了近10个小时对此进行故障排除,并且做得很短.
我已经看了很多答案(包括SO问题24132418和14510237)虽然由于没有声望点我不能包含所有链接
任何指针都会非常感激!
下面似乎很长,因为我已经粘贴了所有日志,如果我错过了一些重要信息,请告诉我
谢谢,-Mark
细节
我一直在研究Heroku的介绍,他们说安装postgresql是一个要求,所以我用自制程序做了
brew install postgresql
Run Code Online (Sandbox Code Playgroud)
我没有检查它,我继续构建我的应用程序,但第二天我在本地运行webapp并得到错误,
Request URL: http://localhost:5000/admin/
Django Version: 1.6.5
Exception Type: OperationalError
Exception Value:
FATAL: could not open relation mapping file "global/pg_filenode.map": No such file or directory
Exception Location: /Users/macuser/Dropbox/code/heroku/awe01/lib/python2.7/site-packages/psycopg2/__init__.py in connect, line 164
Run Code Online (Sandbox Code Playgroud)
所以我想调查一下.现在我以前从未使用过postgresql,所以我想为postgresql"到达命令行"
请注意,我是一个完整的新手,之前从未使用过postgresql.
在mysql中,我知道这将是
mysql -u root -p
Run Code Online (Sandbox Code Playgroud)
(然后输入密码)
我无法在postgresql中做相同的操作
moriartymacbookair13:~ macuser$ postgres
postgres does not know where to find the server configuration file.
You …
Run Code Online (Sandbox Code Playgroud) 编辑:凯文的答案在下面解决了我的问题.原来"allauth不支持命名空间"所以我不应该把它引入我的urls.py
原始邮寄:
我完全按照教程安装了django-allauth
https://github.com/pennersr/django-allauth
我这里有一个非常基本的问题; 甚至在我添加社交集成之前,无法使基本用户登录/退出页面正常工作.
通过导航到/ admin,我点击"退出",所以我不是登录用户.
现在,当我访问时,/accounts/login
我遇到了这个错误
NoReverseMatch at /accounts/login/
Reverse for 'account_signup' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method: GET
Request URL: http://localhost:5000/accounts/login/
Django Version: 1.6.5
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'account_signup' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Run Code Online (Sandbox Code Playgroud)
问题:我是否需要修改默认的allauth views.py来解决这个问题?
在相关的情况下,当我尝试通过shell时,这是同样的问题
(awe01)MoriartyMacBookAir13:getstartapp macuser$ python manage.py shell
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
>>> from django.core.urlresolvers import reverse …
Run Code Online (Sandbox Code Playgroud)