我已经运行了发布的默认django项目,它运行良好,我能够访问它的域名,然后我只是替换了推销员的细节,现在我得到404找不到。这是我的conf文件:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /home/ubuntu/ecom
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/ecom/saleor/saleor/static
<Directory /home/ubuntu/ecom/saleor/saleor/static>
Require all granted
</Directory>
<Directory /home/ubuntu/ecom/saleor/saleor/wsgi>
<Files __init__.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject2 python-home=/home/ubuntu/ecom/ecom python-path=/home/ubuntu/ecom
WSGIProcessGroup myproject2
WSGIScriptAlias / /home/ubuntu/ecom/saleor/saleor/wsgi/__init__.py
</VirtualHost>这里,/home/ubuntu/ecom是我的项目主目录,它包含ecom (虚拟env)和saleor文件夹。我在saleor项目的glintwear.com文件中添加了我的域
编辑这里是来自error.log文件的错误:
[Wed Aug 15 01:09:17.240064 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] mod_wsgi (pid=14328): Target WSGI script '/home/ubuntu/ecom/$
[Wed Aug 15 01:09:17.240110 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] mod_wsgi (pid=14328): Exception occurred processing WSGI scr$
[Wed Aug 15 01:09:17.240269 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] Traceback (most recent call last):
[Wed Aug 15 01:09:17.240291 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] File "/home/ubuntu/ecom/saleor/saleor/wsgi/__init__.py", l$
[Wed Aug 15 01:09:17.240296 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] from django.core.wsgi import get_wsgi_application # noqa
[Wed Aug 15 01:09:17.240310 2018] [wsgi:error] [pid 14328:tid 140275526600448] [remote 39.53.22.238:27753] ImportError: No module named 'django'发布于 2019-09-27 19:32:59
因此,如果有人有问题,我会回答这个问题。这个项目被搁置了,这就是为什么我这么晚才更新它的原因。无论如何,问题是python-home应该指向manage.py所在的根目录。python-path应该指向您的virtualenv文件夹。就是这样。
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /home/ubuntu/ecom
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/ecom/saleor/saleor/static
<Directory /home/ubuntu/ecom/saleor/saleor/static>
Require all granted
</Directory>
<Directory /home/ubuntu/ecom/saleor/saleor/wsgi>
<Files __init__.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject2 python-home=/home/ubuntu/ecom/ecom/saleor python-path=/home/ubuntu/ecom/env
WSGIProcessGroup myproject2
WSGIScriptAlias / /home/ubuntu/ecom/saleor/saleor/wsgi/__init__.py
</VirtualHost>发布于 2018-08-14 16:56:18
编辑:
正如格雷厄姆·邓普尔顿所指出的,你必须改变你的
python-home=/home/ubuntu/ecom/ecom这不是通往虚拟环境的途径。
检查提供给python的目录是否与虚拟环境中的sys.prefix相同。
所以你应该有这样的东西:
python-home=/home/ubuntu/ecom/venvhttps://stackoverflow.com/questions/51843745
复制相似问题