How do I move Django project from my local machine to Linode Debian server?

Hi all,

I'm trying to figure out how to successfully move my Django project from my local machine to Linode.

On my local machine, I enter a virtual environment, run python manage.py runserver, then navigate my browser to localhost:8080 to see my project. It works fine there. What must I do to set this up on my Linode instance so that I can navigate to the Linode address to view it successfully? For example, how do I set things up so I can navigate my browser to http://li1081-100.members.linode.com for example and see my project in all its glory? (That's not my real address).

3 Replies

Linode has a guide for deploying Django on Ubuntu 14.04 here; you can adopt parts of it for other distributions:

https://linode.com/docs/web-servers/ngi … ntu-14-04/">https://linode.com/docs/web-servers/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04/

Django's website also has some good guides for putting your app into production:

https://docs.djangoproject.com/en/2.0/howto/deployment/

Essentially, you're going to have to set up a web server like Apache and Nginx. You'll also set up an application server like uWSGI or Gunicorn to run your Django app. Then, you'll set Apache or Nginx to proxy requests for the app to uWSGI or Gunicorn.

I've managed to get through this portion of the process, using gunicorn
and Ubuntu 18.04LTS instead of uwsgi and 14.04. But what is the best way to move my perfectly working django web app from my personal computer to my Linode VPS? I can easily copy the entire project folder from my personal computer to someplace logical on my Linode VPS, but then what? In particular, how do I configure gUnicorn / nginx to redirect some IP/folder to my new project's service?

I haven't personally done this, so I hope you don't mind if I chime in here. You may have come across this already but if not I wanted to pass along this guide from Django on hosting a site on Linode:

It looks like this covers some of the basics for setting up Django. Though since this uses Apache instead of Nginx you may need to improvise a little.

I can easily copy the entire project folder from my personal computer to someplace logical on my Linode VPS, but then what? In particular, how do I configure gUnicorn / nginx to redirect some IP/folder to my new project's service?

This would need to be configured in your /etc/nginx/conf.d/yousite.com.conf file.

The below is a general guide which provides a helpful overview regarding configuring this file to host your site:

For more specifics on configuring Nginx I wanted to include these two guides as well:

While it's some generalized information, hopefully it helps give you something to work with!

Best of luck.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct