【发布时间】:2021-09-30 22:21:29
【问题描述】:
我正在尝试在 apache2 上部署我的 django 应用程序,我在 AWS ec2 ubuntu 实例上。最初我收到一个致命的 Python 错误:Py_Initialize: Unable to get the locale encoding,所以我通过删除我的 env 并在 3.6 上启动一个新的虚拟 env 将我的 python 从 2.7 切换到 3.6,我还从我的实例中清除了 python 2.7 和 3.7。之后,我的 apache 中有一个名为“Django 错误”的模块。任何帮助都被困在这一段时间了:)。
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /home/ubuntu/pydjangoenv/myproj
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/pydjangoenv/myproj/static
<Directory /home/ubuntu/pydjangoenv/myproj/static>
Require all granted
</Directory>
<Directory /home/ubuntu/pydjangoenv/myproj/myproj>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproj python-path=/home/ubuntu/pydjangoenv/myproj python-home=/home/ubuntu/pydjangoenv/venv2
WSGIScriptAlias / /home/ubuntu/pydjangoenv/myproj/myproj/wsgi.py
</VirtualHost>
当我运行 pip3 install django 时,我的 django 在 要求已经满足:/home/ubuntu/pydjangoenv/venv2/lib/python3.6/site-packages (3.2.5)中的django
【问题讨论】:
标签: python django ubuntu apache2 mod-wsgi