python:django:django_install

文書の過去の版を表示しています。


Djangoのインストール

ここでは、Pythonがインストールされていることを前提に説明を進めることにする。
Python 環境の整え方は、pythonbrew の使い方Python のインストールを参照のこと。

$ pip install django
Downloading/unpacking django
  Downloading Django-1.5.tar.gz (8.0MB): 8.0MB downloaded
  Running setup.py egg_info for package django
    
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: django
  Running setup.py install for django
    changing mode of build/scripts-3.3/django-admin.py from 664 to 775
    
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    changing mode of /home/tomoyan/.pythonbrew/venvs/Python-3.3.0/py33dj15/bin/django-admin.py to 775
Successfully installed django
Cleaning up...

※pipでインストール可能。

  1. Django | Download より Django-x.x.x.tar.gz をダウンロードする。
  2. Django-x.x.tar.gz を適当なフォルダに解凍する。
  3. コマンドラインにて解凍したフォルダにcd(Change directory)して以下のコマンドを実行する。
    > python setup.py install

※pipでインストール可能。

  1. djangoパッケージをインストールする。
    # yum install django

Django Adminツールの動作確認

上記のインストールが完了すると、django-admin.py がパスの通った場所に存在するので、以下のコマンドを実行して動作確認を行う。

$ django-admin.py help
Usage: django-admin.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Print traceback on exception
  --version             show program's version number and exit
  -h, --help            show this help message and exit
~省略~

参考文献:
Python Webフレームワーク、第1回: DjangoとPythonを使ってWeb開発

  • python/django/django_install.1437393935.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)