How to make my django website live to the world after setting up my application with Digital Ocean Droplet?

Posted November 20, 2015 8.1k views

I am trying to deploy my Django website using Digital Ocean Droplet. I followed this documentation to setup my application with Digital Ocean droplet using Nginx and Gunicorn. After this the website is properly running on my system if I visit to my domain name in the bowser. But now I am confused that how should make my website available over the internet to the world. Below is the nginx settings I have used as per the documentation I followed:

server {

    access_log off;

    location /static/ {
        alias /opt/myapp/static/;

    location / {
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';

Above given server_name is the IP of my droplet which is redirected to the domain name of my website.

It would be great if any one can guide me with step by step documentation to make my website live. I believe the Digital Ocean should take my website from the repo in git or bitbucket so that in case of further changes I just need to push my code to the repo and than my droplet can use the updated code. But I am ber much confused about how to do it.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


Line #2, server_name , should ideally be your domain name, if the plan is to use one :-). Simply set it as:

server_name yourdomain.ext www.yourdomain.ext;

… where yourdomain.ext is, or the extension of your choosing. The above sets NGINX up to handle requests with and without the www.. You could also simply setup the same with:

server_name yourdomain.ext *.yourdomain.ext;

The * is referred to as a WildCard, meaning that any sub.yourdomain.ext will be routed to yourdomain.ext unless it exists, in which case the content for that sub-domain would be shown.

Beyond setting up NGINX, you’ll need to ensure that NGINX is started from the CLI (Command Line Interface) by issuing the following command:

service nginx start

Once that’s taken care of, you need to ensure that your domains DNS is properly setup. You’ll need your Droplet’s Public IP Address for this and you’ll need to create two A entries and CNAME entry. If you’ve set your domains DNS to DigitalOcean, you can make these changes through their control panel. If not, you’ll need to login to your domain registrars control panel and make the changes there.

The A entries will look like this:

A               @               DROPLET_PUBLIC_IP
A               *               DROPLET_PUBLIC_IP

.... where DROPLETPUBLICIP = your Droplet’s Public IP Address.

The second A entry is the WildCard entry that coincides with your NGINX server block. If you don’t setup the server block using the WildCard, you can simply omit this one and only add the first.

The CNAME entry will look like this:

CNAME           www             yourdomain.ext

.... simply replace yourdomain.ext with your actual domain name.

With those updates in place, DNS changes can take as little as a few minutes up to 24-48 hours to fully resolve, so don’t be alarmed if you aren’t able to access your domain immediately.

  • Hi @jtittle ,

    Thanks for your comment. I performed all these steps and now waiting for the result. But meanwhile I came up with a thought that my whole Django project is in my local system. Even the nginx and gunicorn setup is also done from my system. So where the Digital Ocean Console comes into the picture. I mean do the DO will always communicates with my system to serves the requests of user. Ideally it should not be the case, right ? I am pretty sure that I am missing a step to upload my whole website to DO server so that everyone through out the world can acess my website. Could you please guide me the way to do it.

    • @billiondollarco

      You would need to physically upload the files from your local dev box (whether Windows or Linux) using SFTP or SSH. FileZilla is free and one of the most well-known FTP & SFTP programs for Windows & Linux. PuTTy is the best option overall for Windows, while the standard terminal offered by pretty much every linux distro is ideal for Linux :-).

      You would need to take a look at steps 6 & 7, since you followed that specific guide, for details on how to manage the project (uploading, deploying, configuring etc). That said, the guide is really just a basic guide to getting it setup. If followed to a tee, you should have a live, working site.

      For something more in-depth, you’d really need to read up on how to manage a Django project, Python etc. Following a short guide is a general way to get you up and running, but that’s really about it.

      That said, if you run in to issues, if DNS didn’t fix it for you etc, feel free to post. I’m always willing to help as much as I can. I don’t specifically use Django, though I do work with various environments, PHP, Python, C++ etc, so when it comes to NGINX, SSH, SFTP and getting files to the server, I can definitely help you there.