How To Setup Django Applications with Apache and mod_wsgi on Ubuntu
azub1904@azub1904:~$ sudo apt-get update
[sudo] azub1904의 암호:
기존:1 http://mirror.kakao.com/ubuntu disco InRelease
기존:2 http://mirror.kakao.com/ubuntu disco-updates InRelease
기존:3 http://mirror.kakao.com/ubuntu disco-backports InRelease
무시:4 http://dl.google.com/linux/chrome/deb stable InRelease
기존:5 http://dl.google.com/linux/chrome/deb stable Release
기존:6 http://packages.microsoft.com/repos/vscode stable InRelease
기존:7 http://ppa.launchpad.net/ondrej/php/ubuntu disco InRelease
받기:8 http://security.ubuntu.com/ubuntu disco-security InRelease [97.5 kB]
기존:9 https://download.sublimetext.com apt/stable/ InRelease
기존:10 http://ppa.launchpad.net/rvm/smplayer/ubuntu disco InRelease
무시:12 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu disco InRelease
오류:13 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu disco Release
404 Not Found [IP: 91.189.95.83 80]
받기:14 http://security.ubuntu.com/ubuntu disco-security/main amd64 DEP-11 Metadata [33.9 kB]
받기:15 http://security.ubuntu.com/ubuntu disco-security/main DEP-11 48×48 Icons [8,744 B]
받기:16 http://security.ubuntu.com/ubuntu disco-security/main DEP-11 64×64 Icons [21.4 kB]
받기:17 http://security.ubuntu.com/ubuntu disco-security/universe amd64 DEP-11 Metadata [17.5 kB]
받기:18 http://security.ubuntu.com/ubuntu disco-security/universe DEP-11 48×48 Icons [14.3 kB]
받기:19 http://security.ubuntu.com/ubuntu disco-security/universe DEP-11 64×64 Icons [44.7 kB]
Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
Target Translations (en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
Target Translations (ko) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
패키지 목록을 읽는 중입니다… 완료
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (ko_KR) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (ko) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
E: The repository ‘http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu disco Release’ does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (ko_KR) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (ko) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
W: Target Translations (en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/sublime-text.list:1
azub1904@azub1904:~$ sudo apt-get install libapache2-mod-wsgi-py3
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
다음 새 패키지를 설치할 것입니다:
libapache2-mod-wsgi-py3
0개 업그레이드, 1개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
91.2 k바이트 아카이브를 받아야 합니다.
이 작업 후 287 k바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 http://mirror.kakao.com/ubuntu disco/main amd64 libapache2-mod-wsgi-py3 amd64 4.6.5-1 [91.2 kB]
내려받기 91.2 k바이트, 소요시간 0초 (1,425 k바이트/초)
Selecting previously unselected package libapache2-mod-wsgi-py3.
(데이터베이스 읽는중 …현재 233512개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack …/libapache2-mod-wsgi-py3_4.6.5-1_amd64.deb …
Unpacking libapache2-mod-wsgi-py3 (4.6.5-1) …
libapache2-mod-wsgi-py3 (4.6.5-1) 설정하는 중입니다 …
apache2_invoke: Enable module wsgi
azub1904@azub1904:~$ cd /etc/apache2
azub1904@azub1904:/etc/apache2$ ls
apache2.conf conf-enabled magic mods-enabled sites-available
conf-available envvars mods-available ports.conf sites-enabled
azub1904@azub1904:/etc/apache2$ sudo nano ports.conf
azub1904@azub1904:/etc/apache2$ cd sites-available/
azub1904@azub1904:/etc/apache2/sites-available$ ls
000-default.conf default-ssl.conf
azub1904@azub1904:/etc/apache2/sites-available$ sudo nano 000-default.conf
azub1904@azub1904:/etc/apache2/sites-available$ sudo nano djangoproject.conf
azub1904@azub1904:/etc/apache2/sites-available$ sudo nano djangoproject.conf
azub1904@azub1904:/etc/apache2/sites-available$ sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
패키지 목록을 읽는 중입니다… 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다… 완료
패키지 libapache2-mod-wsgi-py3는 이미 최신 버전입니다 (4.6.5-1).
패키지 python3-pip는 이미 최신 버전입니다 (18.1-5).
패키지 apache2는 이미 최신 버전입니다 (2.4.38-2ubuntu2.2).
0개 업그레이드, 0개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
azub1904@azub1904:/etc/apache2/sites-available$ sudo a2ensite djangoproject.conf
Enabling site djangoproject.
To activate the new configuration, you need to run:
systemctl reload apache2
azub1904@azub1904:/etc/apache2/sites-available$ sudo nano /etc/hosts
azub1904@azub1904:/etc/apache2/sites-available$ sudo ufw allow ‘Apache Full’
규칙이 업데이트됐습니다
규칙이 업데이트됐습니다(v6)
azub1904@azub1904:/etc/apache2/sites-available$ sudo chmod 664 /var/www/html/djangodev/db.sqlite3
chmod: ‘/var/www/html/djangodev/db.sqlite3’에 접근할 수 없습니다: 그런 파일이나 디렉터리가 없습니다
azub1904@azub1904:/etc/apache2/sites-available$ sudo chown :www-data /var/www/html/djangodev
azub1904@azub1904:/etc/apache2/sites-available$ sudo apache2ctl 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
azub1904@azub1904:/etc/apache2/sites-available$ cd /var/www/html
azub1904@azub1904:/var/www/html$ ls
blog djangodev index.html wordpress-5.2.2.tar.gz
azub1904@azub1904:/var/www/html$ cd djangodev/
azub1904@azub1904:/var/www/html/djangodev$ source env/bin/activate
bash: env/bin/activate: 그런 파일이나 디렉터리가 없습니다
azub1904@azub1904:/var/www/html/djangodev$ sudo chmod 664 /var/www/html/djangodev/mytestsite/db.sqlite3
azub1904@azub1904:/var/www/html/djangodev$ sudo chown :www-data /var/www/html/djangodev/mytestsite/db.sqlite3
azub1904@azub1904:/var/www/html/djangodev$ sudo apache2ctl 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
azub1904@azub1904:/var/www/html/djangodev$ source env/bin/activate
bash: env/bin/activate: 그런 파일이나 디렉터리가 없습니다
azub1904@azub1904:/var/www/html/djangodev$ python3 manage.py runserver
python3: can’t open file ‘manage.py’: [Errno 2] No such file or directory
azub1904@azub1904:/var/www/html/djangodev$ cd mytestsite/
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ cd my
bash: cd: my: 그런 파일이나 디렉터리가 없습니다
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ python3 manage.py runserver
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 08, 2019 – 11:49:25
Django version 2.2.5, using settings ‘mytestsite.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ sudo service apache2 restart
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ sudo service apache2 restart
azub1904@azub1904:/var/www/html/djangodev/mytestsite$
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ sudo service apache2 restart
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ sudo service apache2 restart
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ python manage.py migrate
File “manage.py”, line 16
) from exc
^
SyntaxError: invalid syntax
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ cd ..
azub1904@azub1904:/var/www/html/djangodev$ python manage.py migrate
python: can’t open file ‘manage.py’: [Errno 2] No such file or directory
azub1904@azub1904:/var/www/html/djangodev$ cd ..
azub1904@azub1904:/var/www/html$ cd djangodev/
azub1904@azub1904:/var/www/html/djangodev$ cd mytestsite/
azub1904@azub1904:/var/www/html/djangodev/mytestsite$ cd mytestsite/
azub1904@azub1904:/var/www/html/djangodev/mytestsite/mytestsite$ python manage.py migrate
python: can’t open file ‘manage.py’: [Errno 2] No such file or directory
azub1904@azub1904:/var/www/html/djangodev/mytestsite/mytestsite$