Hello!
There is a server with debian 8.5, nginx, django 1.10, uwsgi, python (2.7, 3.4) all this is used without vitrual env (venv). There is a site on django which pours errors
'ascii' codec can't encode character u'\u0419' in position 2: ordinal not in range(128) Request Method: GET Django Version: 1.10.4 Exception Type: UnicodeEncodeError Exception Value: 'ascii' codec can't encode character u'\u0419' in position 2: ordinal not in range(128) Exception Location: /usr/local/lib/python2.7/dist-packages/django/utils/encoding.py in force_text, line 80 Python Executable: /usr/bin/uwsgi-core Python Version: 2.7.9 Errors due to the fact that python uses Cyrillic there, and python2 does not know how to do it without specifying codepages.
Question: How to make it all run under python3.4 without using virtualenv? Add. infa:
[uwsgi] PROJECT_NAME=%n PROJECT_ROOT=/var/www/%(PROJECT_NAME) chdir=%(PROJECT_ROOT)/src/ touch-reload=%(PROJECT_ROOT)/reload module=core.wsgi plugins=python3,http master=true workers=2 uid=www-data gid=www-data disable-logging=true -
# update-alternatives --config python Есть 2 варианта для альтернативы python (предоставляет /usr/bin/python). Выбор Путь Приор Состояние ------------------------------------------------------------ 0 /usr/bin/python2.7 1 автоматический режим 1 /usr/bin/python2.7 1 ручной режим * 2 /usr/bin/python3.4 0 ручной режим -
Fri Dec 30 14:31:39 2016 - *** Starting uWSGI 2.0.7-debian (64bit) on [Fri Dec 30 14:31:38 2016] *** Fri Dec 30 14:31:39 2016 - compiled with version: 4.9.1 on 25 October 2014 19:17:54 Fri Dec 30 14:31:39 2016 - os: Linux-3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) Fri Dec 30 14:31:39 2016 - machine: x86_64 Fri Dec 30 14:31:39 2016 - clock source: unix Fri Dec 30 14:31:39 2016 - pcre jit disabled Fri Dec 30 14:31:39 2016 - detected number of CPU cores: 2 Fri Dec 30 14:31:39 2016 - current working directory: / Fri Dec 30 14:31:39 2016 - setgid() to 33 Fri Dec 30 14:31:39 2016 - setuid() to 33 Fri Dec 30 14:31:39 2016 - your processes number limit is 1912 Fri Dec 30 14:31:39 2016 - your memory page size is 4096 bytes Fri Dec 30 14:31:39 2016 - detected max file descriptor number: 1024 Fri Dec 30 14:31:39 2016 - lock engine: pthread robust mutexes Fri Dec 30 14:31:39 2016 - thunder lock: disabled (you can enable it with --thunder-lock) Fri Dec 30 14:31:39 2016 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/pjreo.is74/socket fd 3 Fri Dec 30 14:31:39 2016 - Python version: 2.7.9 (default, Mar 1 2015, 13:01:26) [GCC 4.9.2] Fri Dec 30 14:31:40 2016 - *** Python threads support is disabled. You can enable it with --enable-threads *** Fri Dec 30 14:31:40 2016 - Python main interpreter initialized at 0x257a410 Fri Dec 30 14:31:40 2016 - your server socket listen backlog is limited to 100 connections Fri Dec 30 14:31:40 2016 - your mercy for graceful operations on workers is 60 seconds Fri Dec 30 14:31:40 2016 - mapped 218304 bytes (213 KB) for 2 cores Fri Dec 30 14:31:40 2016 - *** Operational MODE: preforking *** Fri Dec 30 09:31:42 2016 - WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x257a410 pid: 1095 (default app) Fri Dec 30 09:31:42 2016 - *** uWSGI is running in multiple interpreter mode *** Fri Dec 30 09:31:42 2016 - spawned uWSGI master process (pid: 1095) Fri Dec 30 09:31:42 2016 - spawned uWSGI worker 1 (pid: 1507, cores: 1) Fri Dec 30 09:31:42 2016 - spawned uWSGI worker 2 (pid: 1508, cores: 1)