PythonのDjangoをDebian上にインストールしてみた
Pythonの有名フレームワークであるDjango(ジャンゴ)を触ってみました。ちょうどDebianの勉強もしていますので、Debianのapt-getでPythonの開発環境も整えつつやってきます。
1. Pythonのバージョン確認
$ python -V Python 2.7.3
2. Djangoのインストール
試しにpython-djangoで検索してみます。
$ sudo apt-cache search python-django python-celery - async task/job queue based on message passing python-celery-doc - async task/job queue based on message passing (Documentation) python-django-dajaxice - agnostic and easy to use AJAX library for django python-django-adminaudit - improves the logging capabilities of Django's admin python-django-app-plugins - plugin system for django python-django-auth-ldap - Django LDAP authentication backend python-django-auth-ldap-doc - Django LDAP authentication backend (documentation) python-django-authority - more powerful permission system for Django python-django-celery - Celery integration for Django python-django-celery-doc - Celery integration for Django (Documentation) python-django-classy-tags - Class based template tags for Django projects python-django-countries - provides a country field for Django models python-django-dajax - easy to use ajax library for django python-django-evolution - Implementation of schema evolution for the Django web framework python-django-extra-views - Extra class-based views for Django python-django-floppyforms - better control of form rendering in Django python-django-genshi - Django integration for Genshi python-django-markupfield - custom Django field for easy use of markup in text fields python-django-nose - Django test runner that uses python-nose python-django-notification - user notification management for Django python-django-auth-openid - provides optional OpenID integration for Django python-django-pagination - utilities for creating pagination tools for Django python-django-picklefield - Pickled object field for Django python-django-reversion - Provides comprehensive version control facilities for Django python-django-sekizai - template blocks for Django projects python-django-threaded-multihost - allows to serve multiple sites from one django installation python-django-horizon - Django module providing web interaction with OpenStack mumble-django - Mumble-Server web interface python-django-mumble - Mumble-Server config application for Django python-django - High-level Python web development framework python-django-doc - High-level Python web development framework (documentation) python-django-contact-form - extensible contact-form application for Django python-django-debug-toolbar - Embedded debugging toolbar for Django projects python-django-djapian - Search API for Django using Xapian python-django-extdirect - Ext.Direct serverside implementation for Django python-django-feincms - Django-based Page CMS and CMS building toolkit python-django-feincms-doc - Django-based Page CMS and CMS building toolkit - documentation python-django-formfieldset - fieldset rendering mixin for Django-based forms python-django-lint - Static analysis tool for Django projects and applications python-django-localeurl - Django application allows the language be set in the URL python-django-mptt - Modified Preorder Tree Traversal Django application python-django-registration - User-registration application for Django python-django-rosetta - Eases the translation process of your Django projects python-django-shorturls - Short URL handler for Django applications python-django-social-auth - Django social authentication made simple python-django-south - Intelligent schema migrations for django apps python-django-tagging - Generic tagging application for Django projects python-django-threadedcomments - simple yet flexible threaded commenting system for Django python-django-tinymce - replacement text widget for Django web framework python-django-treebeard - Efficient implementations of tree data structures for Django python-django-treebeard-doc - Efficient implementations of tree data structures for Django (documentation) python-django-voting - generic voting application for Django python-django-websocket - Websocket support for django python-django-uwsgi-admin - Django application for administering uWSGI server
この中から、python-djangoをインストールします。
$ sudo apt-get install python-django
インストールされた場所は以下になります。
/usr/share/pyshared
3. サンプルサイトを作成してみます
Djangoがインストールできましたので、試しにWebアプリを作成してみます。 vagrantは/vagrant以下が共有フォルダになっているので、/vagrant以下にプロジェクトを作成して、PyCharmで開発します。
myappというプロジェクトを作成します。
$ python /usr/share/pyshared/django/bin/django-admin.py startproject myapp
サーバを起動します。このときIPアドレスをしてます。
$ python ./myapp/manage.py runserver 192.168.33.10:8000
ブラウザから192.168.33.10:8000にアクセスしてみて、以下の画面が出たら成功です。
[04/Jul/2015 03:57:48] "GET / HTTP/1.1" 200 1956 [04/Jul/2015 03:57:48] "GET / HTTP/1.1" 200 1956
また機会があれば色々触ってみたいと思います。
- 作者: Julia Elman,Mark Lavin
- 出版社/メーカー: O'Reilly Media
- 発売日: 2014/11/04
- メディア: Kindle版
- この商品を含むブログを見る