24
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Macでpyenv-virtualenvを使用したDjango開発環境の構築

Last updated at Posted at 2015-06-18

インストールしたもの

  • pyenv
  • pyenv-virtualenv
  • django

をインストールする
(pyenv-virtualenvを入れたら、pyenvは入れなくても大丈夫かも)

pyenvのインストール

$ brew install pyenv
$ brew install pyenv-virtualenv

####bashrcに設定を追加

export PYENV_ROOT=/usr/local/var/pyenv
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

pyenvの最新版をインストール(2015/06/17時点では3.4.3)

$ pyenv install 3.4.3

pyenvとvirtualenvでDjangoのpython仮想環境の構築

$ pyenv virtualenv 3.4.3 django

Django用のアプリを配置するディレクトリを作成

mkdir ~/workspace/django
cd ~/workspace/django

仮想化の設定

pyenv local django

pipのversionを上げる

$ pip install --upgrade pip

djangoのインストール

$ pip install django

djangoのプロジェクトを作成

$ django-admin.py startproject mysite

作成したmysiteへ移動

$ cd mysite/

migration

$ python manage.py migrate

実行

python manage.py runserver

http://127.0.0.1:8000/
に接続して It worked!と表示されたらok

参考URL

http://qiita.com/kaki_k/items/e824cfcf089e75d43551
http://qiita.com/maosanhioro/items/47a52f96fefba7126f9b

24
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?