Professional Documents
Culture Documents
BLEARNINGCLUB
python Django web development programming tutorial and technical blogs
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 1/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
After create the droplet then Open the console ( click on right side on your droplet ). Then you have to login with root and root
password (which you have enter for create droplet ).
Login : root
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 2/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
ufw status
You have to enable it. Type the command below on your cmd
ufw enable
now you have to allow OpenSSH . Type the command on your cmd
Now close the console And open command prompt or terminal in your computer
After open Command prompt or terminal in your computer then type the below command and login with username is root and
password is your root’s password
ssh root@ip_adress
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 3/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
Now you have to update your app rst. so type the below command :
Now wait sometimes and now you have to install python 3 apache2 libapache2-mod-wsgi-py3 . So type the below command :
Now you have to install virtual environment for python 3 . So type the following command :
Now create a directory for your project ( here directory name is myproject )
mkdir ~/myproject
cd ~/myproject
Now you are inside is in myproject . here create a python environment for your project :
virtualenv projectenv
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 4/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
source projectenv/bin/activate
Install the FTP le manager ( File zilla ) from google and open it then you have to put host username and password and port .
username: root
port : 22
Now after successfully connected go to myproject ( go to directory of your python env ) . And just upload your django project ( you
can drag and drop from your computer )
go to settings.py in your django project and allowed host or ip adress . Then you have to set a static directory and Static root
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 5/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
ALLOWED_HOSTS =
. . .
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
Now you can migrate your database and create a superuser .But migrate your database is recommended just type : python
manage.py migrate
Now you can run with local host . But at rst you have to allow the 8000 port :
Now deactivate the environment . because here we will run django by apache
(projectenv) $ deactivate
Now that your Django project is working, we can con gure Apache as a front end.Now you have to edit con guration for Apache
server . At rst go to sites available in Apache 2 folder and you have to edit 000-default.conf le :
Or You can use File zilla ( FTP Fie manager ) and edit 000-default.conf . Add this code and commet out the document root at rst (
recommended) :
</Directory>
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 7/8
5/23/2021 DEPLOY YOUR DJANGO PROJECT ON DIGITALOCEAN – python Django web development tutorial | Blearningclub
Now you can run your Django project successfully . And also you can add a custom domain
https://blearningclub.com/?print-my-blog=1&post-type=post&statuses%5B0%5D=publish&rendering_wait=0&columns=1&font_size=normal&image_size=medium&links=include&show_site_title=1&show… 8/8