Skip to content

Instantly share code, notes, and snippets.

@YoshihitoAso
Last active October 16, 2015 04:38
Show Gist options
  • Select an option

  • Save YoshihitoAso/157111e0da2865343c4a to your computer and use it in GitHub Desktop.

Select an option

Save YoshihitoAso/157111e0da2865343c4a to your computer and use it in GitHub Desktop.
Ubuntu上にDjango(Django REST framework)用開発環境を構築したときのメモ(作成中)
#AnacondaでPythonの仮想環境を構築
conda create -n django django
conda info -e
source activate django
※ipythonも入れておく
conda install ipython
conda install ipython-notebook
#Djangoプロジェクトを作成する
django-admin.py startproject restapi ※restapiというプロジェクト名(何でも良い)
cd restapi/
python manage.py migrate
python manage.py runserver
※ブラウザでhttp://127.0.0.1:8000/ or http://localhost:8000/ にアクセスして「It worked!」の画面が出ればOK。
#superuserを作成する
※Django1.6以前とはやりかたが異なるみたいなので注意。
python manage.py createsuperuser
※途中メールアドレスとかを聞かれるけど、[email protected] ※とか適当でOK
python manage.py runserver
※ブラウザでhttp://localhost:8000/admin/ にアクセスすると、Djangoの管理者画面が出てくるはず
#appを作る
python manage.py startapp apiapp ※apiappのところは好きな名前で
※以下のようなフォルダ構成になる
.
├── __init__.py
├── admin.py
├── migrations
│   └── __init__.py
├── models.py
├── tests.py
└── views.py
#あとは好きなように作る
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment