EC2 인스턴스 할당하기
Security Group > Add Rule
- HTTP
- HTTPS
- Custom -> TCP -> 8000 -> 0.0.0.0/0, ::/0
Review and Launch > Launch
- Create a new key pair
- 원하는 이름 설정
- Download Key Pair
- Launch Instance
Elastic IP 받기
Network & Security > Elastic IPs
Allocate Elastic IP address
Allocate
Associate Elastic IP address
Instance > 아까 생성된 인스턴스 선택
Associate
SSH 연결하기
ssh ubuntu@아까받은ElasticIP -i 다운받은PEM_FILE
Django 프로젝트의 settings.py 수정
- DEBUG = (os.environ.get('DEBUG', 'True') != 'False')
- ALLOWED_HOSTS = ['*']
- pip freeze > requirements.txt
- git add -A, commit 해서 git repo에 push
Termius
- python3 -m venv venv #가상 환경 생성
- git clone {내GitHub레포지토리} {django-app}
- cd {django-app}
- source ../venv/bin/activate
- pip install -r requirements.txt
- python manage.py runserver 0.0.0.0:8000
하면 http:// {나의 Elastic_IP:8000} 으로 접속 가능