Report this

What is the reason for this report?

Do I use FTP to publish to my Django / Gunicorn / Enginx server - if not how do I publish?

Posted on June 20, 2019

I have followed all of the instructions and was able to successfully a Django, Gunicorn Enginx and PostgreSQL server on Ubuntu 18.04. All of the DNS is working great and from what I can tell, the setup was successful. I now have 3 questions …

  1. Do I set up FTP to publish to the site? If not what means do I use to publish?

  2. The Django virtual environment (per the tutorial) lives in the home directory of the user I made. Is this the correct location for the folder?

  3. Do I need to publish static files to the /static folder that was created? How do I manage this?



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!

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.

Hello,

  1. Instead of using FTP, it’s recommended to use SSH/SCP/SFTP for secure and efficient file transfer. You can use tools like FileZilla (with SFTP) or rsync for this purpose. Here’s a guide on using FileZilla and SCP to transfer files to your Droplet.

  2. Storing the Django virtual environment in the user’s home directory is acceptable, but you can also put it in a project-specific directory if you prefer. Just ensure it’s in a secure and accessible location. You can learn about serving Django applications in this tutorial.

  3. Yes, you need to publish the static files to the /static folder for proper handling by Nginx. To manage this, use Django’s collectstatic command. This command will gather all the static files and put them in the designated folder:

  1. python manage.py collectstatic

For further information, refer to the Django documentation about managing static files.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.