APACHE2 + Python3 + django + Mysql

 

 

 

 

azub@azub-Compaq-Presario-CQ60-Notebook-PC:~$ /
-bash: /: 디렉터리입니다
azub@azub-Compaq-Presario-CQ60-Notebook-PC:~$ .
-bash: .: 파일이름 인수 필요
.: 사용법: . filename [arguments]
azub@azub-Compaq-Presario-CQ60-Notebook-PC:~$ cd
azub@azub-Compaq-Presario-CQ60-Notebook-PC:~$ cd.

Command ‘cd.’ not found, did you mean:

command ‘cdb’ from deb tinycdb
command ‘cdv’ from deb codeville
command ‘cdi’ from deb cdo
command ‘cde’ from deb cde
command ‘cdo’ from deb cdo
command ‘cdp’ from deb irpas
command ‘cdw’ from deb cdw
command ‘cd5’ from deb cd5

Try: sudo apt install <deb name>

azub@azub-Compaq-Presario-CQ60-Notebook-PC:~$ cd ..
azub@azub-Compaq-Presario-CQ60-Notebook-PC:/home$ cd ..
azub@azub-Compaq-Presario-CQ60-Notebook-PC:/$ cd ..
azub@azub-Compaq-Presario-CQ60-Notebook-PC:/$ cd root
-bash: cd: root: 허가 거부
azub@azub-Compaq-Presario-CQ60-Notebook-PC:/$ su root
암호:
root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd ..
root@azub-Compaq-Presario-CQ60-Notebook-PC:/# clear

root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd tutorial
bash: cd: tutorial: 그런 파일이나 디렉터리가 없습니다
root@azub-Compaq-Presario-CQ60-Notebook-PC:/# mkdir tutorial
root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd tutorial/
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# mkdir site
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# mkdir django
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# mkdir auth
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd site
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# mkdir logs
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# mkdir public
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# ls
logs public
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# ls -al
합계 16
drwxr-xr-x 4 root root 4096 9월 10 23:25 .
drwxr-xr-x 5 root root 4096 9월 10 23:23 ..
drwxr-xr-x 2 root root 4096 9월 10 23:25 logs
drwxr-xr-x 2 root root 4096 9월 10 23:25 public
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# sudo apt install python3-pip
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
패키지 python3-pip는 이미 최신 버전입니다 (9.0.1-2.3~ubuntu1.18.04.1).
0개 업그레이드, 0개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# pip3 freeze
apturl==0.5.2
asn1crypto==0.24.0
Brlapi==0.6.6
certifi==2018.1.18
chardet==3.0.4
command-not-found==0.3
cryptography==2.1.4
cupshelpers==1.0
defer==1.0.6
distro-info===0.18ubuntu0.18.04.1
Django==2.2.5
httplib2==0.9.2
idna==2.6
keyring==10.6.0
keyrings.alt==3.0
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.13.5
lazr.uri==1.0.3
louis==3.5.0
macaroonbakery==1.1.3
Mako==1.0.7
MarkupSafe==1.0
netifaces==0.10.4
oauth==1.0.1
olefile==0.45.1
pexpect==4.2.1
Pillow==5.1.0
protobuf==3.0.0
pycairo==1.16.2
pycrypto==2.6.1
pycups==1.9.73
pygobject==3.26.1
pymacaroons==0.13.0
PyNaCl==1.1.2
pyRFC3339==1.0
python-apt==1.6.4
python-dateutil==2.6.1
python-debian==0.1.32
pytz==2018.3
pyxdg==0.25
PyYAML==3.12
reportlab==3.4.0
requests==2.18.4
requests-unixsocket==0.1.5
SecretStorage==2.3.1
simplejson==3.13.2
six==1.11.0
sqlparse==0.3.0
ssh-import-id==5.7
system-service==0.3
systemd-python==234
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.22
usb-creator==0.3.3
virtualenv==16.7.5
wadllib==1.3.2
xkit==0.0.0
zope.interface==4.3.2
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# sudo pip3 install virtualenv
Requirement already satisfied: virtualenv in /usr/local/lib/python3.6/dist-packages
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# cd ..
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# virtualenv venv -p python3
Already using interpreter /usr/bin/python3
Using base prefix ‘/usr’
New python executable in /tutorial/venv/bin/python3
Also creating executable in /tutorial/venv/bin/python
Installing setuptools, pip, wheel…
done.
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# source venv/bin/activate
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# pip freeze
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# pip install django
Collecting django
Downloading https://files.pythonhosted.org/packages/94/9f/a56f7893b1280e5019482260e246ab944d54a9a633a01ed04683d9ce5078/Django-2.2.5-py3-none-any.whl (7.5MB)
|████████████████████████████████| 7.5MB 1.2MB/s
Collecting sqlparse (from django)
Downloading https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a37886585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Collecting pytz (from django)
Downloading https://files.pythonhosted.org/packages/87/76/46d697698a143e05f77bec5a526bf4e56a0be61d63425b68f4ba553b51f2/pytz-2019.2-py2.py3-none-any.whl (508kB)
|████████████████████████████████| 512kB 6.4MB/s
Installing collected packages: sqlparse, pytz, django
Successfully installed django-2.2.5 pytz-2019.2 sqlparse-0.3.0
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd django/django startproject tutorial
bash: cd: 인수가 너무 많음
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd django/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# django startproject tutorial
django: 명령을 찾을 수 없습니다
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# django-admin startproject tutorial
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# ls
manage.py tutorial
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# ls
__init__.py settings.py urls.py wsgi.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# nano settings.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# ls
manage.py tutorial
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Performing system checks…

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.

September 10, 2019 – 14:50:12
Django version 2.2.5, using settings ‘tutorial.settings’
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py runserver 0.0.0.0:9000
Watching for file changes with StatReloader
Performing system checks…

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.

September 10, 2019 – 14:50:29
Django version 2.2.5, using settings ‘tutorial.settings’
Starting development server at http://0.0.0.0:9000/
Quit the server with CONTROL-C.
Invalid HTTP_HOST header: ‘0.0.0.0:9000’. You may need to add ‘0.0.0.0’ to ALLOWED_HOSTS.
Bad Request: /
[10/Sep/2019 14:51:23] “GET / HTTP/1.1” 400 59755
Invalid HTTP_HOST header: ‘0.0.0.0:9000’. You may need to add ‘0.0.0.0’ to ALLOWED_HOSTS.
Bad Request: /favicon.ico
[10/Sep/2019 14:51:24] “GET /favicon.ico HTTP/1.1” 400 59688
[10/Sep/2019 14:51:48] “GET / HTTP/1.1” 200 16348
[10/Sep/2019 14:51:48] “GET /static/admin/css/fonts.css HTTP/1.1” 200 423
Not Found: /favicon.ico
[10/Sep/2019 14:51:48] “GET /favicon.ico HTTP/1.1” 404 1978
[10/Sep/2019 14:51:49] “GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1” 200 85876
[10/Sep/2019 14:51:49] “GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1” 200 86184
[10/Sep/2019 14:51:49] “GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1” 200 85692
[10/Sep/2019 14:52:14] “GET /admin/ HTTP/1.1” 302 0
[10/Sep/2019 14:52:15] “GET /admin/login/?next=/admin/ HTTP/1.1” 200 1819
[10/Sep/2019 14:52:15] “GET /static/admin/css/base.css HTTP/1.1” 200 16378
[10/Sep/2019 14:52:15] “GET /static/admin/css/login.css HTTP/1.1” 200 1233
[10/Sep/2019 14:52:15] “GET /static/admin/css/responsive.css HTTP/1.1” 200 17944
[10/Sep/2019 14:52:50] “GET / HTTP/1.1” 200 16348
[10/Sep/2019 14:52:50] “GET /static/admin/css/fonts.css HTTP/1.1” 200 423
[10/Sep/2019 14:52:51] “GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1” 200 86184
[10/Sep/2019 14:52:51] “GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1” 200 85692
[10/Sep/2019 14:52:51] “GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1” 200 85876
Not Found: /favicon.ico
[10/Sep/2019 14:52:51] “GET /favicon.ico HTTP/1.1” 404 1978
[10/Sep/2019 14:53:09] “GET /admin/login/?next=/admin/ HTTP/1.1” 200 1819
[10/Sep/2019 14:53:09] “GET /static/admin/css/base.css HTTP/1.1” 200 16378
[10/Sep/2019 14:53:09] “GET /static/admin/css/login.css HTTP/1.1” 200 1233
[10/Sep/2019 14:53:09] “GET /static/admin/css/responsive.css HTTP/1.1” 200 17944
[10/Sep/2019 14:53:09] “GET /static/admin/css/fonts.css HTTP/1.1” 200 423
Not Found: /favicon.ico
[10/Sep/2019 14:53:09] “GET /favicon.ico HTTP/1.1” 404 1978
[10/Sep/2019 14:53:09] “GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1” 200 85876
[10/Sep/2019 14:53:09] “GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1” 200 85692
^Z
[1]+ 정지됨 python manage.py runserver 0.0.0.0:9000
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# cd /
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# sudo apt install mysql-server
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
다음의 추가 패키지가 설치될 것입니다 :
libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
mysql-server-5.7 mysql-server-core-5.7
제안하는 패키지:
libipc-sharedcache-perl mailx tinyca
다음 새 패키지를 설치할 것입니다:
libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
mysql-server mysql-server-5.7 mysql-server-core-5.7
0개 업그레이드, 9개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
20.5 M바이트 아카이브를 받아야 합니다.
이 작업 후 161 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 mysql-common all 5.8+1.0.4 [7,308 B]
받기:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B]
받기:3 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-client-core-5.7 amd64 5.7.27-0ubuntu0.18.04.1 [7,040 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-client-5.7 amd64 5.7.27-0ubuntu0.18.04.1 [2,302 kB]
받기:5 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server-core-5.7 amd64 5.7.27-0ubuntu0.18.04.1 [7,779 kB]
받기:6 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libevent-core-2.1-6 amd64 2.1.8-stable-4build1 [85.9 kB]
받기:7 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server-5.7 amd64 5.7.27-0ubuntu0.18.04.1 [3,196 kB]
받기:8 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB]
받기:9 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mysql-server all 5.7.27-0ubuntu0.18.04.1 [9,948 B]
내려받기 20.5 M바이트, 소요시간 2초 (8,223 k바이트/초)
패키지를 미리 설정하는 중입니다…
Selecting previously unselected package mysql-common.
(데이터베이스 읽는중 …현재 176629개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack …/0-mysql-common_5.8+1.0.4_all.deb …
Unpacking mysql-common (5.8+1.0.4) …
Selecting previously unselected package libaio1:amd64.
Preparing to unpack …/1-libaio1_0.3.110-5ubuntu0.1_amd64.deb …
Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) …
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack …/2-mysql-client-core-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking mysql-client-core-5.7 (5.7.27-0ubuntu0.18.04.1) …
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack …/3-mysql-client-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking mysql-client-5.7 (5.7.27-0ubuntu0.18.04.1) …
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack …/4-mysql-server-core-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking mysql-server-core-5.7 (5.7.27-0ubuntu0.18.04.1) …
Selecting previously unselected package libevent-core-2.1-6:amd64.
Preparing to unpack …/5-libevent-core-2.1-6_2.1.8-stable-4build1_amd64.deb …
Unpacking libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) …
mysql-common (5.8+1.0.4) 설정하는 중입니다 …
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(데이터베이스 읽는중 …현재 176797개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack …/mysql-server-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking mysql-server-5.7 (5.7.27-0ubuntu0.18.04.1) …
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack …/libhtml-template-perl_2.97-1_all.deb …
Unpacking libhtml-template-perl (2.97-1) …
Selecting previously unselected package mysql-server.
Preparing to unpack …/mysql-server_5.7.27-0ubuntu0.18.04.1_all.deb …
Unpacking mysql-server (5.7.27-0ubuntu0.18.04.1) …
libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) 설정하는 중입니다 …
libhtml-template-perl (2.97-1) 설정하는 중입니다 …
libaio1:amd64 (0.3.110-5ubuntu0.1) 설정하는 중입니다 …
mysql-client-core-5.7 (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
mysql-server-core-5.7 (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
mysql-client-5.7 (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
mysql-server-5.7 (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
mysql-server (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
Processing triggers for libc-bin (2.27-3ubuntu1) …
Processing triggers for systemd (237-3ubuntu10.28) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ureadahead (0.100.0-21) …
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# sudo mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named ‘test’ that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
– Dropping test database…
Success.

– Removing privileges on test database…
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/#

 

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# clear

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ’19winner’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ’19winner19winner19winner’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ‘1qaz2wsx3edc4rfv5tgb6yhn!!’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ‘1qaz2wsx3edc4rfv5tgb6yhn!!’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ‘1qaz2wsx3edc4rfv5tgb6yhn!!’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ‘1qaz2wsx3edc4rfv5tgb6yhn!!^^’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> CREATE USER ‘azub’@’localhost’ IDENTIFIED BY ‘!QAZ@WSX3edc4rfv%%TGB^^YHN’;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE djangoproject;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON djangoproject.* to ‘azub’@’localhost’;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE tutorial;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON tutorial.* to ‘azub’@’localhost’;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| djangoproject |
| mysql |
| performance_schema |
| sys |
| tutorial |
+——————–+
6 rows in set (0.00 sec)

mysql> exit
Bye
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# pip freeze
Django==2.2.5
pytz==2019.2
sqlparse==0.3.0
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# sudo apt install python3-dev
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
패키지 python3-dev는 이미 최신 버전입니다 (3.6.7-1~18.04).
python3-dev 패키지는 수동설치로 지정합니다.
0개 업그레이드, 0개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# sudo apt install libmysqlclient-dev
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
다음의 추가 패키지가 설치될 것입니다 :
libmysqlclient20 zlib1g-dev
다음 새 패키지를 설치할 것입니다:
libmysqlclient-dev libmysqlclient20 zlib1g-dev
0개 업그레이드, 3개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
2,152 k바이트 아카이브를 받아야 합니다.
이 작업 후 11.8 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmysqlclient20 amd64 5.7.27-0ubuntu0.18.04.1 [816 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu bionic/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-0ubuntu2 [176 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmysqlclient-dev amd64 5.7.27-0ubuntu0.18.04.1 [1,160 kB]
내려받기 2,152 k바이트, 소요시간 0초 (9,099 k바이트/초)
Selecting previously unselected package libmysqlclient20:amd64.
(데이터베이스 읽는중 …현재 176898개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack …/libmysqlclient20_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking libmysqlclient20:amd64 (5.7.27-0ubuntu0.18.04.1) …
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack …/zlib1g-dev_1%3a1.2.11.dfsg-0ubuntu2_amd64.deb …
Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) …
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack …/libmysqlclient-dev_5.7.27-0ubuntu0.18.04.1_amd64.deb …
Unpacking libmysqlclient-dev (5.7.27-0ubuntu0.18.04.1) …
libmysqlclient20:amd64 (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) 설정하는 중입니다 …
libmysqlclient-dev (5.7.27-0ubuntu0.18.04.1) 설정하는 중입니다 …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for libc-bin (2.27-3ubuntu1) …
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# pip install mysqlclient
Collecting mysqlclient
Downloading https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz (86kB)
|████████████████████████████████| 92kB 570kB/s
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) … done
Created wheel for mysqlclient: filename=mysqlclient-1.4.4-cp36-cp36m-linux_x86_64.whl size=98547 sha256=179594eac2e5d9735fa0352a7d15606f2366df79b1bdeefe2706fdb46d42617d
Stored in directory: /root/.cache/pip/wheels/a0/04/57/031b9b01df38999df7dc7f4ee998a98ecdbd2d781f73e3ffbf
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.4
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# pip freeze
Django==2.2.5
mysqlclient==1.4.4
pytz==2019.2
sqlparse==0.3.0
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd auth
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth# nano mysql.cnf
nano로 되돌아오려면 “fg”를 입력하십시오.

[2]+ 정지됨 nano mysql.cnf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth# sudo systemctl restart mysql
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth#

 

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth# cat mysql.cnf
[client]
database = ‘tutorial’
user = ‘azub’
password = ‘!QAZ@WSX3edc4rfv%%TGB^^YHN’
default-character-set = ‘utf8’

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth#

 

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/auth# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd django/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# ls
tutorial
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# ls
__init__.py __pycache__ settings.py urls.py wsgi.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# nano settings.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# nano settings.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# ls
db.sqlite3 manage.py tutorial
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py check
System check identified no issues (0 silenced).
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial… OK
Applying auth.0001_initial… OK
Applying admin.0001_initial… OK
Applying admin.0002_logentry_remove_auto_add… OK
Applying admin.0003_logentry_add_action_flag_choices… OK
Applying contenttypes.0002_remove_content_type_name… OK
Applying auth.0002_alter_permission_name_max_length… OK
Applying auth.0003_alter_user_email_max_length… OK
Applying auth.0004_alter_user_username_opts… OK
Applying auth.0005_alter_user_last_login_null… OK
Applying auth.0006_require_contenttypes_0002… OK
Applying auth.0007_alter_validators_add_error_messages… OK
Applying auth.0008_alter_user_username_max_length… OK
Applying auth.0009_alter_user_last_name_max_length… OK
Applying auth.0010_alter_group_name_max_length… OK
Applying auth.0011_update_proxy_permissions… OK
Applying sessions.0001_initial… OK
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py createsuperuser
Username (leave blank to use ‘root’):
Email address:
Password:
Password (again):
Superuser created successfully.
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py runserver 0.0.0.0:9000
Watching for file changes with StatReloader
Performing system checks…

System check identified no issues (0 silenced).
September 10, 2019 – 15:54:48
Django version 2.2.5, using settings ‘tutorial.settings’
Starting development server at http://0.0.0.0:9000/
Quit the server with CONTROL-C.
Error: That port is already in use.
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py runserver 0.0.0.0:9001
Watching for file changes with StatReloader
Performing system checks…

System check identified no issues (0 silenced).
September 10, 2019 – 15:55:11
Django version 2.2.5, using settings ‘tutorial.settings’
Starting development server at http://0.0.0.0:9001/
Quit the server with CONTROL-C.
[10/Sep/2019 15:55:19] “GET / HTTP/1.1” 200 16348
[10/Sep/2019 15:55:19] “GET /static/admin/css/fonts.css HTTP/1.1” 200 423
[10/Sep/2019 15:55:20] “GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1” 200 86184
[10/Sep/2019 15:55:20] “GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1” 200 85876
[10/Sep/2019 15:55:20] “GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1” 200 85692
Not Found: /favicon.ico
[10/Sep/2019 15:55:20] “GET /favicon.ico HTTP/1.1” 404 1978
[10/Sep/2019 15:55:27] “GET /admin/ HTTP/1.1” 302 0
[10/Sep/2019 15:55:27] “GET /admin/login/?next=/admin/ HTTP/1.1” 200 1819
[10/Sep/2019 15:55:27] “GET /static/admin/css/responsive.css HTTP/1.1” 200 17944
[10/Sep/2019 15:55:27] “GET /static/admin/css/login.css HTTP/1.1” 200 1233
[10/Sep/2019 15:55:27] “GET /static/admin/css/base.css HTTP/1.1” 200 16378
[10/Sep/2019 15:55:38] “POST /admin/login/?next=/admin/ HTTP/1.1” 302 0
[10/Sep/2019 15:55:38] “GET /admin/ HTTP/1.1” 200 3041
[10/Sep/2019 15:55:38] “GET /static/admin/css/dashboard.css HTTP/1.1” 200 412
[10/Sep/2019 15:55:38] “GET /static/admin/img/icon-changelink.svg HTTP/1.1” 200 380
[10/Sep/2019 15:55:38] “GET /static/admin/img/icon-addlink.svg HTTP/1.1” 200 331
^Z
[3]+ 정지됨 python manage.py runserver 0.0.0.0:9001
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial#

 

 

================

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ErrorLog /tutorial/site/logs/error.log
CustomLog /tutorial/site/logs/access.log combined

<Directory /tutorial/django/tutorial/tutorial/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

WSGIDaemonProcess tutorial python-path=/tutorial/django/tutorial python-home=/tutorial/venv
WSGIProcessGroup tutorial
WSGIScriptAlias / /tutorial/django/tutorial/tutorial/wsgi.py

Alias /static /tutorial/site/public/static
<Directory /tutorial/site/public/static>
Require all granted
</Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

 

 

==================

(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# sudo systemctl restart apache2
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# nano 000-default.conf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# cd/
bash: cd/: 그런 파일이나 디렉터리가 없습니다
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# cd /
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd site/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# cd public
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public# ls
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public# mkdir static
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# ls
bin dev initrd.img lib64 mnt root snap sys usr vmlinuz.old
boot etc initrd.img.old lost+found opt run srv tmp var
cdrom home lib media proc sbin swapfile tutorial vmlinuz
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# ls
auth django site venv
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd django/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# cd tutorial/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# ls
__init__.py __pycache__ settings.py urls.py wsgi.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# nano settings.py
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial/tutorial# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# python manage.py collectstatic

119 static files copied to ‘/tutorial/site/public/static’.
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django/tutorial# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/django# cd ..
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial# cd site
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site# cd public/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public# cd static/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static# ls
admin
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static# cd admin
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static/admin#
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static/admin# ls
css fonts img js
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static/admin# nano 000-default.conf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static/admin# ls
css fonts img js
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/tutorial/site/public/static/admin# cd /etc/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc# cd apache2/sites-available/ls
bash: cd: apache2/sites-available/ls: 그런 파일이나 디렉터리가 없습니다
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc# cd apache2/sites-available/
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# ls
000-default.conf default-ssl.conf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# nano 000-default.conf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# sudo apachectl configtest
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
Syntax OK
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# sudo systemctl restart apache2
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# nano 000-default.conf
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# sudo apachectl configtest
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
Syntax OK
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available# sudo systemctl restart apache2
(venv) root@azub-Compaq-Presario-CQ60-Notebook-PC:/etc/apache2/sites-available#