開発

DjangのCMS「Mezzanine」をインストール


TokyoDjangoMeetup #3 – connpassの時に教えていただいてMezzanineというDjangoのCMSが気になったのでインストールしてみようかなと。

ちなみに環境は、Amazon Linux, Python 3.4.3, Django 1.8です。 # 追記。Mezzanineを入れると強制的にDjango (1.6.11)になる模様。

Mezzanine – The Best Django CMS
のサイトに従ってインストール開始。

$ sudo pip install mezzanine
で、無事インストール完了。

$ pip list
〜〜
Mezzanine (3.1.10)
〜〜
無事インストールされているみたいです。

プロジェクトを作成。
$ mezzanine-project first_mezzanine

first_mezzanineがプロジェク名になるので適宜変更。
で、作成したプロジェクトに移動して、
$ cd first_mezzanine/
$ python3 manage.py createdb
/usr/local/lib/python3.4/site-packages/mezzanine/utils/conf.py:52: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django 1.5 requires. Will fall back to the domains configured as sites.
warn("You haven't defined the ALLOWED_HOSTS settings, which "
/usr/local/lib/python3.4/site-packages/mezzanine/utils/conf.py:60: UserWarning: TIME_ZONE setting is not set, using closest match: UTC
warn("TIME_ZONE setting is not set, using closest match: %s" % tz)
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_redirect
Creating table django_session
Creating table django_site
Creating table conf_setting
Creating table core_sitepermission_sites
Creating table core_sitepermission
Creating table generic_threadedcomment
Creating table generic_keyword
Creating table generic_assignedkeyword
Creating table generic_rating
Creating table blog_blogpost_categories
Creating table blog_blogpost_related_posts
Creating table blog_blogpost
Creating table blog_blogcategory
Creating table forms_form
Creating table forms_field
Creating table forms_formentry
Creating table forms_fieldentry
Creating table pages_page
Creating table pages_richtextpage
Creating table pages_link
Creating table galleries_gallery
Creating table galleries_galleryimage
Creating table twitter_query
Creating table twitter_tweet
Creating table south_migrationhistory
Creating table django_admin_log
Creating table django_comments
Creating table django_comment_flags

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'ec2-user'):
Email address:
Password:
Password (again):
Superuser created successfully.

A site record is required.
Please enter the domain and optional port in the format 'domain:port'.
For example 'localhost:8000' or 'www.example.com'.
Hit enter to use the default (127.0.0.1:8000):

Creating default site record: ...

Installed 2 object(s) from 1 fixture(s)

Would you like to install some initial demo pages?
Eg: About us, Contact form, Gallery. (yes/no): yes

Creating demo pages: About us, Contact form, Gallery ...

Installed 16 object(s) from 3 fixture(s)
/usr/local/lib/python3.4/site-packages/mezzanine/utils/html.py:76: DeprecationWarning: The value of convert_charrefs will become True in 3.5. You are encouraged to set the value explicitly.
HTMLParser.__init__(self)

/usr/local/lib/python3.4/site-packages/django/utils/html.py:121: DeprecationWarning: The strict argument and mode are deprecated.
HTMLParser.__init__(self, strict=False)

/usr/local/lib/python3.4/site-packages/django/utils/html.py:121: DeprecationWarning: The value of convert_charrefs will become True in 3.5. You are encouraged to set the value explicitly.
HTMLParser.__init__(self, strict=False)

Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

South is installed for this project.
Would you like to fake initial migrations? (yes/no): yes

Faking initial migrations ...

で、気になったところ。
まず、
You just installed Django’s auth system, which means you don’t have any superusers defined.
Would you like to create one now? (yes/no):
と聞かれました。スーパーユーザを作るか?という質問と思います。ということでyesとして、ユーザ名、メールアドレス、パスワードを設定。

次に、
Please enter the domain and optional port in the format ‘domain:port’.
For example ‘localhost:8000’ or ‘www.example.com’.
Hit enter to use the default (127.0.0.1:8000):
ですが、どうもドメイン設定ができてしまうみたいです。とりあえず、今回はお試しで、このAWSのインスタンスで設定しているドメインを設定してみました。

次に、
Would you like to install some initial demo pages?
Eg: About us, Contact form, Gallery. (yes/no):
ですが、デモページを作る?という話かと思いyesを選択。

最後に、
Would you like to fake initial migrations? (yes/no): yes
と聞かれました。とりあえず、yes。

まずは、動かしてみようかと思います。

サイトはこんな感じ。
Mezzanineをインストール_1

管理画面はこんな感じ。
Mezzanineをインストール_2