1

djangoプロジェクトに1つのアプリがあります。

seo.pyファイルを作成して追加しました:

rollyourownimportseoから

class MyMetadata(seo.Metadata):
    title = seo.Tag(head=True, max_length=68)
    description = seo.MetaTag(max_length=155)
    keywords = seo.KeywordTag()

    class HelpText:
        title  = "This will appear in the window/tab name, as well as in search results."
        keywords = "A comma separated list of words or phrases that describe the content"
        description = "This will appear in the description"

    class Meta:
        seo_views = ('app_name', )

私のbase.htmlheadに追加しました:

{% load seo %}
{% get_metadata %} 

しかし、何も表示されません。なにが問題ですか?(もちろん、管理パネルにデータを追加しました-メタデータ(表示))

4

2 に答える 2

0

settings.py の INSTALLED_APPS 変数にそのアプリケーションを配置していない場合、テンプレート タグ ライブラリのロードは機能しません。そこにrollyourown.seoを入れましたか?

設定する必要があるパスは、'/pagename/' の形式である必要があります。ホームページの場合は、'/' だけが必要です。

于 2013-01-29T09:59:14.830 に答える