DEV Community

loading...

Django on AMI

asdflkjh profile image kinaamnay ・2 min read

If you're using AMI then there are few things to take note before proceeding.

  • AMI have yum as package manager.
  • AMI Linux 2 has amazon-linux-extras which are available as topics

Setup the environment

sudo yum update -y

sudo yum install gcc

cat /var/run/yum.pid

ps -p 3633

ps -ef | grep 3633

kill -9 3633

sudo amazon-linux-extras install python3

curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip install --upgrade pip

yum search pip
sudo yum install python3-pip

python3 -m venv /path/to/new/virtual/environment

sudo pip3 install virtualenv

sudo amazon-linux-extras install nginx1

mkdir project-name
cd project-name

virtualenv env
. env/bin/activate

pip3 install django

pip3 install uwsgi

django-admin --version

uwsgi --socket /opt/uwsgi/sock/yt_demo.sock --wsgi-file /home/ec2-user/project/testsite/testsite/wsgi.py

Enter fullscreen mode Exit fullscreen mode

Note: I have taken help from multiple source and prepared this article. And all source deserves to receive the credits.

Credits,

Discussion (0)

pic
Editor guide