最近、pythonの勉強をし始めました。
ぼくは、Windows10のWSLをインストールしてそこを開発環境にしてたりするよ。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# パッケージ最新化 root@LAPTOP-T2J2FP9L:~# apt-get -y update # venvインストール root@LAPTOP-T2J2FP9L:~# apt-get -y install python-virtualenv root@LAPTOP-T2J2FP9L:~# virtualenv venv root@LAPTOP-T2J2FP9L:~# source venv/bin/activate # djangoインストール (venv) root@LAPTOP-T2J2FP9L:~# pip install -U pip (venv) root@LAPTOP-T2J2FP9L:~# pip install django # djangoバージョン確認 (venv) root@LAPTOP-T2J2FP9L:~# django-admin --version 1.11.14 # venv環境抜ける (venv) root@LAPTOP-T2J2FP9L:~# deactivate # test用プロジェクト作成 root@LAPTOP-T2J2FP9L:~# cd ~/venv/ root@LAPTOP-T2J2FP9L:~/venv# source bin/activate (venv) root@LAPTOP-T2J2FP9L:~/venv# django-admin startproject projecttest (venv) root@LAPTOP-T2J2FP9L:~/venv# cd projecttest/ # DB作成 デフォルトだとSQLiteがインストールされる (venv) root@LAPTOP-T2J2FP9L:~/venv/projecttest# python manage.py migrate # 管理者ユーザ作成 (venv) root@LAPTOP-T2J2FP9L:~/venv/projecttest# python manage.py createsuperuser Username (leave blank to use 'root'): yuta Email address: a@yahoo.co.jp Password: Password (again): Error: Your passwords didn't match. Password: Password (again): Superuser created successfully. (venv) root@LAPTOP-T2J2FP9L:~/venv/projecttest# # サーバ起動 Ctrl+Cで停止 (venv) root@LAPTOP-T2J2FP9L:~/venv/projecttest# python manage.py runserver 0.0.0.0:8080 Performing system checks... System check identified no issues (0 silenced). July 08, 2018 - 04:19:45 Django version 1.11.14, using settings 'projecttest.settings' Starting development server at http://0.0.0.0:8080/ Quit the server with CONTROL-C. [08/Jul/2018 04:19:58] "GET / HTTP/1.1" 200 1716 Not Found: /favicon.ico [08/Jul/2018 04:19:58] "GET /favicon.ico HTTP/1.1" 404 1967 [08/Jul/2018 04:20:07] "GET /admin HTTP/1.1" 301 0 [08/Jul/2018 04:20:07] "GET /admin/ HTTP/1.1" 302 0 [08/Jul/2018 04:20:07] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1650 [08/Jul/2018 04:20:07] "GET /static/admin/css/login.css HTTP/1.1" 200 1203 [08/Jul/2018 04:20:07] "GET /static/admin/css/base.css HTTP/1.1" 200 16066 [08/Jul/2018 04:20:07] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423 [08/Jul/2018 04:20:07] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 80304 [08/Jul/2018 04:20:07] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 81348 [08/Jul/2018 04:20:29] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0 [08/Jul/2018 04:20:29] "GET /admin/ HTTP/1.1" 200 2778 [08/Jul/2018 04:20:29] "GET /static/admin/css/dashboard.css HTTP/1.1" 200 412 [08/Jul/2018 04:20:29] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 200 331 [08/Jul/2018 04:20:29] "GET /static/admin/img/icon-changelink.svg HTTP/1.1" 200 380 [08/Jul/2018 04:20:29] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 82564 |
ブラウザで「http://localhost:8080/admin」へアクセス