Question

Problems with django one-click-app image

So I’ve spent the whole night to get my existing django project to work with this image. Some problems remained:

  • How to replace python 2 with python 3 and why do you offer python2 as default in 2018??
  • How to rename django_project?
  • Where are configs and log files of all software involved in running django?
  • Why has django to listen on interfaces other that loopback? Isn’t it unsecure? And your code to get all interface addresses doesn’t find 127.0.0.1 on windows.
  • How to restart django after fixing errors without restarting the whole VM?
  • Why are SFTP operations so hell slow, especially if copying many small files?

Some solutions I’ve found. Probably they will help others:

  • If you have 504 error, read /var/log/syslog. I did it this way: 7z a /var/log/syslog.7z /var/log/syslog as root and then downloaded /var/log/syslog.7z. You have to install 7zip first.
  • django user need to have at least recursive read permission to /home/django/django_project . I’ve worked as root. Fixed it with
# cd /home
# chown -R django:django django
  • You need to add this code from sample project to your setting.py. I don’t know why
import netifaces
def ip_addresses():
    ip_list = []
    for interface in netifaces.interfaces():
        addrs = netifaces.ifaddresses(interface)
        for x in (netifaces.AF_INET, netifaces.AF_INET6):
            if x in addrs:
                ip_list.append(addrs[x][0]['addr'])
    return ip_list

# Discover our IP address
ALLOWED_HOSTS = ip_addresses()

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.

Honestly the “one click” Django droplet does not really work, and it’s definitely not one click, I was trying to get it working all day, and in the end just started a fresh ubuntu install and set it up myself. I DON’T RECOMMEND using this droplet… Here is a pretty straight forward tutorial http://rahmonov.me/posts/deploy-a-django-app-to-digitalocean/