'Install Django on Gandi instance

I am trying to install an Django app on Gandi.

For now, what I have is un file name wsgi.py:

import sys
import os
import os.path

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'cms')))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cms.settings')
from django.core.wsgi import get_wsgi_application

And an other name requirements.txt:

django-cms

When I do pip --version: pip 22.0.4 from /home/hosting-user/.local/lib/python3.9/site-packages/pip (python 3.9)

When I do python3 --version: python 3.5.3 (I don't know why because I have a 3.9 write in my Gandi dashboard, maybe it's a part of the probleme)

When I do django-admin startproject django_delights: bash: django-admin: command not found

When I do python -m django startproject mysite: /usr/bin/python: No module named django (same with python3

When I do env:

LC_ALL=C
LD_LIBRARY_PATH=/opt/mysql-8.0/lib/x86_64-linux-gnu:/opt/mysql-8.0/lib/x86_64-linux-gnu
LANG=C
OLDPWD=/srv/data/web
DB_VERSION=8.0
CUSTOMER_DIR=/srv/data
container_ttys=/dev/pts/0 /dev/pts/1 /dev/pts/2 /dev/pts/3
SHELL_START=true
MAX_MEM=256
DB_USER=hosting-db
PREFIX=/
container=lxc
LOCAL_DIR=/srv/run
WWW_ENGINE=python
PWD=/srv/data/web/vhosts/default
HOME=/home/hosting-user
SYS_USER=hosting-admin
MYSQL_HOME=/srv/data/.config/mysql-8.0
TMPDIR=/srv/data/tmp
PIP_LOG=/srv/data/var/log/www/pip.log
DB_ENGINE=mysql
PAAS=lamp0
PIP_BUILD_DIR=/srv/data/tmp/pip-build
TERM=vt100
APP_USER=hosting-app0
PIP_SRC_DIR=/srv/data/tmp/pip-src
PAAS_USER=hosting-user
SHLVL=4
PYTHONPATH=/srv/data/web/vhosts/default/local/lib/python2.7
WWW_VERSION=3.9
NO_MOUNT=yes
LOGROTATE_CONF=/srv/data/var/admin/logrotate.conf
PHP_USER=hosting-user
PATH=/usr/sbin:/usr/bin:/sbin/:/bin:/opt/python-3.9/bin:/opt/python-3.9/sbin:/opt/python-3.9/usr/bin:/opt/python-3.9/usr/sbin:/opt/mysql-8.0/bin:/opt/mysql-8.0/sbin:/opt/mysql-8.0/usr/bin:/opt/mysql-8.0/usr/sbin:/opt/sqlite-3/bin:/opt/python-3.9/bin:/opt/python-3.9/sbin:/opt/python-3.9/usr/bin:/opt/python-3.9/usr/sbin:/opt/mysql-8.0/bin:/opt/mysql-8.0/sbin:/opt/mysql-8.0/usr/bin:/opt/mysql-8.0/usr/sbin:/opt/sqlite-3/bin
GITWEB_USER=hosting-user
LD_PRELOAD= /usr/local/lib/gandi/gandi-preload.so
DISTRIB=jessie
_=/usr/bin/env


Solution 1:[1]

So, I found how to do it, sort of... I don't start the project on the server, I start it on my own computer. I move the file wsgi.py at the same level than manage.py. Then, in the file settings.py look for the line ALLOWED_HOSTS, for me this was line 28, and add you domain's name : ALLOWED_HOSTS = ['www.mysite.com'] If you don't do it well, you'll get an error with domain name you need to add. Restart your server and it should be good.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gautier Chuinard