Install Django di Openlitespeed Server

Dari Dokumentasi Robie
Loncat ke navigasi Loncat ke pencarian
robie@server2:~$ sudo su
root@server2:/home/robie# apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.8ubuntu1.1).
The following packages were automatically installed and are no longer required:
 fonts-droid-fallback fonts-noto-mono gir1.2-nm-1.0 ipset libavahi-client3
 libavahi-common-data libavahi-common3 libcups2 libgs9 libgs9-common libidn11
 libijs-0.35 libipset13 libjbig2dec0 libnftables1 libnm0 libopenjp2-7
 libpaper-utils libpaper1 poppler-data python3-decorator python3-firewall
 python3-nftables python3-selinux python3-slip python3-slip-dbus
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
You have new mail in /var/mail/root
root@server2:/home/robie# apt-get install python3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-dev is already the newest version (3.8.2-0ubuntu2).
The following packages were automatically installed and are no longer required:
 fonts-droid-fallback fonts-noto-mono gir1.2-nm-1.0 ipset libavahi-client3
 libavahi-common-data libavahi-common3 libcups2 libgs9 libgs9-common libidn11
 libijs-0.35 libipset13 libjbig2dec0 libnftables1 libnm0 libopenjp2-7
 libpaper-utils libpaper1 poppler-data python3-decorator python3-firewall
 python3-nftables python3-selinux python3-slip python3-slip-dbus
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
root@server2:/home/robie# curl -O http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.7.tgz
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
 100 48997  100 48997    0     0  45877      0  0:00:01  0:00:01 --:--:-- 45877
root@server2:/home/robie# ls
wsgi-lsapi-1.7.tgz
root@server2:/home/robie# tar xf wsgi-lsapi-1.7.tgz 
root@server2:/home/robie# ls
wsgi-lsapi-1.7  wsgi-lsapi-1.7.tgz
root@server2:/home/robie# cd wsgi-lsapi-1.7
root@server2:/home/robie/wsgi-lsapi-1.7# python3 ./configure.py 
Done.
root@server2:/home/robie/wsgi-lsapi-1.7# make
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat - Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o main.o main.c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat - Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o wsgi.o wsgi.c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat -Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o wsgiinput.o wsgiinput.c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat - Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o wsgiwrapper.o 
wsgiwrapper.c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat - Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o lsapilib.o lsapilib.c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat -Werror=format-security  -g -fwrapv -O2    -O0 -g3 -I. -I/usr/include/python3.8  -I. -I/usr/include/python3.8  -c -o lsapi-glue.o lsapi-glue.c
x86_64-linux-gnu-gcc -pthread -Wl,-Bsymbolic-functions  -Wl,-z,relro -g -fwrapv -O2    -L/usr/lib -Xlinker -export-dynamic -Wl,-O1 -Wl,- Bsymbolic-functions -o lswsgi main.o wsgi.o wsgiinput.o wsgiwrapper.o lsapilib.o lsapi-glue.o -L/usr/lib/python3.8/config-3.8-x86_64-linux- gnu -lpython3.8 -lcrypt -lpthread -ldl  -lutil -lm -lm
root@server2:/home/robie/wsgi-lsapi-1.7# ls
configure.py  lsapi-glue.o  lswsgi    Makefile.in  wsgi.h       wsgi.o
interp.h      lsapilib.c    main.c    test.py      wsgiinput.c  wsgi_start.py
lsapidef.h    lsapilib.h    main.o    version.h    wsgiinput.o  wsgiwrapper.c
lsapi-glue.c  lsapilib.o    Makefile  wsgi.c       wsgi-int.h   wsgiwrapper.o
root@server2:/home/robie/wsgi-lsapi-1.7# cp lswsgi /usr/local/lsws/fcgi-bin/
root@server2:/home/robie/wsgi-lsapi-1.7# virtualenv --system-site-package /home/web.robiehakim.my.id/public_html/
Using base prefix '/usr'
New python executable in /home/web.robiehakim.my.id/public_html/bin/python3
Also creating executable in /home/web.robiehakim.my.id/public_html/bin/python
Installing setuptools, pip, wheel...
done.
root@server2:/home/robie/wsgi-lsapi-1.7# source /home/web.robiehakim.my.id/public_html/bin/activate
(public_html) root@server2:/home/robie/wsgi-lsapi-1.7# pip3 install django
Collecting django
 Downloading Django-4.1.3-py3-none-any.whl (8.1 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.1/8.1 MB 6.4 MB/s eta 0:00:00
Collecting asgiref<4,>=3.5.2
 Downloading asgiref-3.5.2-py3-none-any.whl (22 kB)
Collecting backports.zoneinfo
 Downloading backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl (74 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.0/74.0 kB 1.1 MB/s eta 0:00:00
Collecting sqlparse>=0.2.2
 Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.8/42.8 kB 680.3 kB/s eta 0:00:00
Installing collected packages: sqlparse, backports.zoneinfo, asgiref, django
Successfully installed asgiref-3.5.2 backports.zoneinfo-0.2.1 django-4.1.3 sqlparse-0.4.3
(public_html) root@server2:/home/robie/wsgi-lsapi-1.7# cd /home/web.robiehakim.my.id/public_html/
(public_html) root@server2:/home/web.robiehakim.my.id/public_html# ls
bin  include  index.html  lib
(public_html) root@server2:/home/web.robiehakim.my.id/public_html# django-admin startproject robieweb
(public_html) root@server2:/home/web.robiehakim.my.id/public_html# ls
bin  include  index.html  lib  robieweb
(public_html) root@server2:/home/web.robiehakim.my.id/public_html# cd robieweb/
(public_html) root@server2:/home/web.robiehakim.my.id/public_html/robieweb# nano robieweb/settings.py 
Pada bagian ini
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ["*"]
(public_html) root@server2:/home/web.robiehakim.my.id/public_html/robieweb#