2
2

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.

Pythonのコマンドについて

Last updated at Posted at 2018-04-29

Pythonのコマンドを整理します

  • 環境

Windows 10
Python 3.6.5
Django 2.0.4
仮想環境 C:\python\env1

1.仮想環境を起動する

env1\Scripts\activate

2.仮想環境を終了する

env1\Scripts\deactivate

3.Pythonのバージョンを確認する(仮想環境を起動後)

(env1) c:\python>python --version
Python 3.6.5

4.Djangoのバージョンを確認する(仮想環境を起動後)

(1)python スクリプトで確認

(env1) c:\python>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'2.0.4'
>>>

(2)pipコマンドでインストールしたライブラリのバージョンを確認

(env1) c:\python>pip list
Package               Version
--------------------- --------------
click                 6.7
Django                2.0.4
django-bootstrap-form 3.4
django-bootstrap4     0.0.6
djangorestframework   3.8.2
ez-setup              0.9
Flask                 1.0.2
itsdangerous          0.24
Jinja2                2.10
MarkupSafe            1.0
mod-wsgi              4.6.4+ap24vc14
Pillow                5.1.0
pip                   10.0.1
psycopg2              2.7.4
pytz                  2018.4
reportlab             3.4.0
setuptools            39.1.0
Werkzeug              0.14.1
wheel                 0.30.0

5.プロジェクトの作成

(env1) c:\python>django-admin.py startproject myproject1

6.アプリケーションの作成

(env1) c:\python>python manage.py startapp myapp1

7.プロジェクトの起動

myproject1\manage.py runserver

8.プロジェクトの終了(プロジェクト起動中に)

「ctl + c」を入力する

9.migrations

python manage.py makemigrations [app名]
python manage.py sqlmigrate [app名] 0001
python manage.py migrate

10.管理者用ユーザ登録

python manage.py createsuperuser

11.pipでインストールしたパッケージをすべてアンインストールする。

pip freeze > uninstall.txt
pip uninstall -r uninstall.txt
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?