How to view the local django web server running on the digital ocean droplet from my computer

I ssh into the digital ocean server, run the django app, and i want to view the web server to see if the app is working correctly, there are no error logs so i assume so.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You can have the django service listen on your public IP by starting it with a command like:

./ runserver [your ip]:8080

For production, putting something like nginx in front of your app is a better idea. You can do this by first installing nginx

sudo apt-get update;
sudo apt-get install nginx;

and then updating your /etc/nginx/sites-enabled/default file to read:

server {

        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm;

        server_name _;

        location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;


Then, restarting nginx:

service nginx restart

Now you’ll be able to browse to your droplet’s IP (without specifying a port) and view your django application.