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
- 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/syslogas 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]['addr']) return ip_list # Discover our IP address ALLOWED_HOSTS = ip_addresses()
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.