Leave it instead of a memo. It is assumed that the instance is standing upright.
The original version of Python that comes with Amazon Linux is 2.7.12
.
That's why this time I will install Python 3 series.
Fortunately, YUM's amzn-main repository has a collection of Python3.
# yum list | grep python35
python35.x86_64 3.5.1-13.7.amzn1 @amzn-main
python35-devel.x86_64 3.5.1-13.7.amzn1 @amzn-main
python35-libs.x86_64 3.5.1-13.7.amzn1 @amzn-main
python35-pip.noarch 6.1.1-1.23.amzn1 @amzn-main
python35-setuptools.noarch 12.2-1.32.amzn1 @amzn-main
python35-tools.x86_64 3.5.1-13.7.amzn1 @amzn-main
python35-virtualenv.noarch 12.0.7-1.13.amzn1 @amzn-main
mod24_wsgi-python35.x86_64 3.5-1.23.amzn1 amzn-main
python35-libs.i686 3.5.1-13.7.amzn1 amzn-main
python35-test.x86_64 3.5.1-13.7.amzn1 amzn-main
Select a package from this. In my case, I did the following.
# yum install python35-devel python35-libs python35-setuptools
** I didn't install pip here because I will install it later using easy_install. ** **
After the installation is complete, you can use Python 3.5 with the command python35
.
# python35
Python 3.5.1 (default, Sep 13 2016, 18:48:37)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Next, install pip for Python3 series.
# /usr/bin/easy_install-3.5 pip
You can now use pip for python3 with the command pip3
.
For the time being, upgrade pip.
# pip3 install --upgrade pip
And install Django
# pip3 install django
Make sure you have installed it successfully.
# python35
Python 3.5.1 (default, Sep 13 2016, 18:48:37)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.10.2
>>>
If it looks like the above, you have successfully installed it.
** If you check with a web browser, please allow the request to number 80 in the security group. ** **
For now, create a directory for Django.
# mkdir django
# cd django
Next, create a project.
# django-admin startproject pro1 #pro1 is the project name
# cd pro1 #Move to the project directory
# python35 manage.py migrate
# python35 manage.py createsuperuser #Create superuser
Run the web server.
# python35 manage.py runserver 0:80 #IP address:Specified by port. If the IP address is 0, it also works for the outside
Now, when you access the server from your web browser, you should see the page below.
Thank you for your support.
Recommended Posts