Ответ 1
Я узнал, как создать mod_wsgi, который будет использоваться с Python 3.3.5, на Ubuntu 12.04 LTS.
Фокус в том, чтобы установить пакет python3.3-dev, который не поддерживается на Ubuntu 12.04 LTS ( "точно" ). Существует сторонний репозиторий, поддерживаемый Felix Krull, который создает старые и новые сборки Python (Kudos to Felix!):
https://launchpad.net/~fkrull/+archive/deadsnakes
Чтобы установить репозиторий Felix:
sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update
Прежде чем приступать к созданию mod_wsgi, нам нужен пакет apache2-dev...
sudo apt-get install apache2-dev
... и получить пакет python3.3-dev (это также устанавливает python3.3!)
sudo apt-get install python3.3-dev
Загрузите код mod_wsgi и создайте его, указав путь к только что установленным библиотекам и заголовкам Python (/usr/bin/python3.3). Ссылка для загрузки с последней версией mod_wsgi можно найти по адресу:
https://github.com/GrahamDumpleton/mod_wsgi/releases
cd /usr/local/src sudo wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/modwsgi/mod_wsgi-3.4.tar.gz sudo tar -zxvf mod_wsgi-3.4.tar.gz cd mod_wsgi-3.4/ sudo ./configure --with-python=/usr/bin/python3.3 sudo make sudo make install
mod_wsgi.so помещается в /usr/lib/apache 2/modules/
Дополнительный шаг: Поскольку они отсутствовали, я вручную (повторно) создал файлы wsgi.conf и wsgi.load в /etc/apache 2/mods-available (хотя мне не нужно было устанавливать какой-либо конкретный вариант).
wsgi.conf:
<IfModule mod_wsgi.c> # See http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives #WSGISocketPrefix: Configure directory to use for daemon sockets. #WSGISocketPrefix /var/run/apache2/wsgi #WSGIPythonOptimize: Enables basic Python optimisation features. #WSGIPythonOptimize 0 #WSGIPythonPath: Additional directories to search for Python modules, # overriding the PYTHONPATH environment variable. #WSGIPythonPath directory|directory-1:directory-2:... #WSGIPythonEggs: Directory to use for Python eggs cache. #WSGIPythonEggs directory #WSGIRestrictEmbedded: Enable restrictions on use of embedded mode. #WSGIRestrictEmbedded On|Off #WSGIRestrictStdin: Enable restrictions on use of STDIN. #WSGIRestrictStdout: Enable restrictions on use of STDOUT. #WSGIRestrictSignal: Enable restrictions on use of signal(). #WSGIRestrictStdin On #WSGIRestrictStdout On #WSGIRestrictSignal On #WSGIAcceptMutex: Specify type of accept mutex used by daemon processes. #WSGIAcceptMutex default #WSGIImportScript: Specify a script file to be loaded on process start. #WSGIImportScript process-group=name application-group=name #WSGILazyInitialization: Enable/disable lazy initialisation of Python. #WSGILazyInitialization On|Off </IfModule>
wsgi.load:
LoadModule wsgi_module/usr/lib/apache2/modules/mod_wsgi.so
Наконец, mod_wsgi можно включить, создав символические ссылки следующим образом:
cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/wsgi.conf wsgi.conf sudo ln -s ../mods-available/wsgi.load wsgi.load
Сообщите мне, если это также сработало для вас!