0

I never hosted any website before may be thats why this task became so tough for me.I searched various codes for deployment but wasn't able to host my website.

i used python 3.6.4 and django 2.0.2 with mysql database for my website. It would be a great help if i get steps from scratch for deployment with my requirements.

Thanks in advance!

1 Answers1

1

Below are the basic steps to host your django website on any linux based server.

1) Create requirements.txt file which will include all your pip packages. On your local enviroment just do pip freeze. It will show you something as below. Include those package to your file.

   Django==1.11.15
   pkg-resources==0.0.0
   pytz==2018.5

2) Create virtual env on your ec2 amazon instance. You can follow same step give on below website. https://docs.python-guide.org/dev/virtualenvs/

3) Install you local packages to this virtual env.

4) If you have mysql as backend you can install mysql with below command sudo apt-get install mysql* Or you can use RDS (Amazon Relational Database Service)

5) Check if you django is able to connect to mysql using below command python manage.py check

6) If above command work without error, You need to install two things. 1) Application server 2) Web server

7) You can use any Application server like uwsgi, gunicorn https://uwsgi-docs.readthedocs.io/en/latest/ https://gunicorn.org/

8) Web server will be nginx https://nginx.org/en/

9) For you static file you will need Bucket. You need to create bucket and host you static files their.

You can find help online to achieve above steps.

Lavanya Pant
  • 702
  • 7
  • 23