By joshuad2
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.
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!
You can have the django service listen on your public IP by starting it with a command like:
./manage.py 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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.