Answer the question
In order to leave comments, you need to log in
Yes, how to run this ... Django?
Task: Put the project on a VPS from Reg.ru based on CentOS:
What I do:
Ps First, in the hosting panel, I link the domain name and VPS through DNSadmin.
Pss A number of steps for installing components are omitted, as they are related to the operation of the necessary elements of the project, and not to work on the VPS.
1) I create a user with sudo rights. - bakotiinii
2) I set a set of commands:
sudo yum install epel-release
sudo yum install python-pip
sudo yum install wget
sudo pip install virtualenv virtualenvwrapper
echo "export WORKON_HOME=~/Env" >> ~/.bashrc #Все окружения буду сохранять в папку Env
echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
tar -xvf Python-3.4.3.tar.xz
cd Python-3.4.3
./configure
make
sudo make install
DEBUG = False
ALLOWED_HOSTS = [
'*',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db',
'USER': 'dbuser',
'PASSWORD': 'dbpassword',
'HOST': 'localhost',
'PORT': '',
}
}
sudo yum install python-devel gcc
sudo pip install uwsgi
sudo mkdir -p /etc/uwsgi/sites
cd /etc/uwsgi/sites
sudo nano apifolder.ini
################
[uwsgi]
project = apifolder # имя проекта
username = bakotiinii # пользователь
base = /home/%(username)
chdir = %(base)/%(project)
home = %(base)/Env/%(project)
module = %(project).wsgi:application
master = true
processes = 5
uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 660
vacuum = true
[Unit]
Description=uWSGI Emperor service
[Service]
ExecStartPre=/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown bakotiinii:nginx /run/uwsgi'
ExecStart=/usr/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
sudo yum install nginx
sudo nano /etc/nginx/nginx.conf
server {
listen 80;
server_name domen.ru www.domen.ru;
location = favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/bakotiinii/apifolder;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/apifolder.sock;
}
}
sudo nginx -t
sudo usermod -a -G bakotiinii nginx
chmod 710 /home/bakotiinii
sudo systemctl start nginx
sudo systemctl start uwsgi
crit] 7288#0: *52 connect() to unix:/run/uwsgi/apifolder.sock failed (2: No such file or directory) while connecting to upstream
bakot uwsgi: uwsgi socket 0 bound to UNIX address /run/uwsgi/apifolder.sock fd 3
bakot uwsgi: setuid() to 1000
bakot uwsgi: Python version: 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
bakot uwsgi: Set PythonHome to /home/bakotiinii/Env/apifolder
bakot uwsgi: ImportError: No module named site
bakot uwsgi: VACUUM: unix socket /run/uwsgi/apifolder.sock removed.
bakot uwsgi: [emperor] unrecognized vassal event on fd 7
bakot uwsgi: [emperor] unrecognized vassal event on fd 5
bakot uwsgi: Fri Feb 12 02:34:01 2016 - [emperor] removed uwsgi instance apifolder.ini
ImportError: No module named site
Answer the question
In order to leave comments, you need to log in
Turn on the Enginix logs with the debug flag and see what happens in them. Fakap somewhere at his level, it can easily be a problem with the rights
Judging by the screenshot, the virtual domain looks in the wrong direction, I don’t rummage in django, but maybe you need to specify the directory for nginx in the config where to get the files? For /static/ you have root specified. And the domain must have an A record from the IP of this server.root /var/www/public;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question