자정시간 귀가안내 서비스의 챗봇 소프트웨어는 자유 소프트웨어입니다. (GPLv3 사용, LICENSE 파일 참고)
Midnight Guide To Home Service chatbot software is a free software. (Used GPLv3, see LICENSE file.)
웹 서비스를 운영하는데 필요한 기능들을 모은 장고 앱입니다.
Django app is collected functions required to operate the web services.
페이스북 챗봇 서비스를 운영하는데 필요한 기능들을 모은 장고 앱입니다.
Django app_fb is collected functions required to operate the Facebook chatbot service.
카카오 i 오픈빌더 스킬을 운영하기 위해 필요한 기능들을 모은 장고 앱입니다.
Django app_kakaoi is collected functions required to operate the Kakao i open builder skills.
서비스를 운영하는데 필요한 라이브러리 파이썬 파일입니다. 각종 메서드, 서비스 안내문 (문자열 변수), 소규모 정적 데이터베이스 등을 모아놓았습니다.
It is a library Python file required to operate the service. Various methods, service announcements (string variables), small static database, and so on.
이미지, admin 페이지 css, js 파일 등을 관리하는 장고 static 파일입니다.
자정시간 귀가안내 서비스 요청에 사용되는 이미지도 포함되어 있습니다.
It is a Django static files managing the images, css, js files of the admin page, etc.
It contains images used by Midnight Guide To Home requests.
Linux (Ubuntu, Debian, etc.), Python 3.7 or more, Django 3.2, uWSGI, nginx
settings.py 파일을 수정한 후에, 다른 데이터베이스 모듈을 사용할 수도 있습니다.
After modifying settings.py file, you can also use the other database module.
settings_secret_removed.py 파일에서 SECRET_KEY
등을 추가해서
이름을 settings.py로 원래대로 변경 후 사용하면 됩니다.
In settings_secret_removed.py file, add SECRET_KEY
, etc.,
and change the name back to its original name, settings.py.
다음과 같이 3개의 문자열 변수를 지정해주면 됩니다. 챗봇 운영시 반드시 필요합니다.
You can specify 3 string variables as follows. It is absolutely necessary to operate chatbot.
만약 일부 토큰이 없으면, 빈 문자열(''
)로 놔두셔도 좋으나
해당 토큰을 사용하는 URL은 비활성화 하는 것을 권장합니다.
If you don't have some tokens, you can leave them as an empty string (''
),
but I recommend disabling URLs that use them.
PAGE_ACCESS_TOKEN = (Own Facebook Page Access Token)
VERIFY_TOKEN = (Facebook Verification Token for Callback URL)
API_KEY = (Google Maps API Key)
(우분투 18.04 기준, Based on Ubuntu 18.04)
$ sudo apt update
$ sudo apt install python3-pip
$ sudo pip3 install virtualenv
$ virtualenv venv
$ cd venv
$ source bin/activate
(venv) $ pip3 install django
(venv) $ cd ..
(venv) $ git clone https://github.com/creationyun/MidnightGuideToHome.git
(venv) $ deactivate
$ pip3 install uwsgi
$ cd /etc
$ sudo mkdir -p uwsgi/sites
$ cd uwsgi/sites
$ sudo nano MidnightGuideToHome_uwsgi.ini
[uwsgi]
project = MidnightGuideToHome
base = /home/<user>
chdir = %(base)/%(project)
home = %(base)/venv
module = %(project).wsgi:application
master = true
processes = 5
socket = %(base)/%(project)/%(project).sock
chmod-socket = 666
vacuum = true
(base: MidnightGuideToHome이 있는 위치. (/home/<user>로 표시) /home/ubuntu 형태인 경우가 많다.)
(base: location with MidnightGuideToHome. It is often in the form of /home/ubuntu.)
$ cd /etc/systemd/system
$ sudo nano uwsgi.service
[Unit]
Description=uWSGI Emperor service
[Service]
ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites --uid <user>
Restart=on-failure
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
StandardError=syslog
[Install]
WantedBy=multi-user.target
$ sudo apt install nginx
$ sudo nano /etc/nginx/sites-available/MidnightGuideToHome
server {
listen 80;
server_name localhost example.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/<user>/MidnightGuideToHome;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/home/<user>/MidnightGuideToHome/MidnightGuideToHome.sock;
}
}
$ sudo ln -s /etc/nginx/sites-available/MidnightGuideToHome /etc/nginx/sites-enabled
$ sudo nginx -t
settings.py 파일을 수정하고(비밀 키 추가), tokens.py 파일을 만든 다음에...
Modify settings.py (add secret key), make tokens.py file and...
아래 명령어를 실행해주세요.
Please run commands below.
(venv) $ sudo systemctl restart nginx
(venv) $ sudo systemctl enable uwsgi
(venv) $ sudo systemctl start uwsgi
(venv) $ cd MidnightGuideToHome
(venv) $ ./manage.py migrate
비밀 키와 호스트를 MidnightGuideToHome/MidnightGuideToHome/settings.py의 ALLOWED_HOSTS에 추가해주세요.
Please add your secret key and hosts in ALLOWED_HOSTS of MidnightGuideToHome/MidnightGuideToHome/settings.py
- Email: [email protected]
- Facebook: https://www.facebook.com/creationyun