1. APACHE 연동
Listen Port 확인
root@8e91d875f85e:/etc/apache2# vi /etc/apache2/ports.conf
~
Listen 80
~
Available Site에 포트 정보 확인
root@8e91d875f85e:/etc/apache2/sites-available# more 000-default.conf
<VirtualHost *:80>
ServerAdmin fancy@localhost.com
ServerName 127.0.0.1
ServerAlias localhost.com
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
WSGIDaemonProcess wsgi user=www-data group=www-data threads=5
WSGIProcessGroup wsgi
WSGIScriptAlias / /var/www/PerfONEw/PerfONEw/wsgi.py
<Directory /var/www/PerfONEw/PerfONEw>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
Alias /static/ /var/www/PerfONEw/static/
<Directory /var/www/PerfONEw/static/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
wsgi.py의 위치를 Django의 Project 아래의 wsgi.py로 설정, Directory를 이의 directory로 설정하면 됨
Apache 실행
root@8e91d875f85e:/etc/apache2# service apache2 start
* Starting Apache httpd web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name,
using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
*
root@8e91d875f85e:/etc/apache2#
Apache2.conf 에 다음 내용 추가
vi /etc/apache2/apache2.conf
~
ServerName localhost
Apache 재수행
root@8e91d875f85e:/etc/apache2# service apache2 stop
* Stopping Apache httpd web server apache2 *
root@8e91d875f85e:/etc/apache2# service apache2 start
* Starting Apache httpd web server apache2 *
-> Browser 확인 시 Internal Error 발생
wsgi.py 설정 확인 및 수정
root@8e91d875f85e:/var/www/PerfONEw/PerfONEw# more wsgi.py
"""
WSGI config for PerfONEw project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PerfONEw.settings')
application = get_wsgi_application()
"""
import os, sys
"""
path = "/var/www/PerfONEw/PerfONEw"
"""
path = os.path.abspath(__file__+'/../..')
if path not in sys.path:
sys.path.append(path)
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PerfONEw.settings')
application = get_wsgi_application()
Apache 서비스 재수행 후 Browser 재확인
root@8e91d875f85e:/var/log/apache2# service apache2 restart
* Restarting Apache httpd web server apache2 [ OK ]
-> Browser 확인 완료 : OK !!!
'Development (Python, Django, C..)' 카테고리의 다른 글
[Django] Model 관리 (0) | 2020.02.20 |
---|---|
[Django] Django Application 생성(analyze) (0) | 2020.02.19 |
[Django] DJANGO + MARIADB 연동 (0) | 2020.02.18 |
[Django] Tutorial 따라하기 - 6 (0) | 2019.11.29 |
[Django] Tutorial 따라하기 - 5 (0) | 2019.11.27 |