我正在尝试使用django site here中的教程设置apache和一个现有的django项目。我的操作系统是Ubuntu,一切都安装好了(django apache2 libapache2-mod-wsgi)
我的conf文件
WSGIPythonPath /home/avlahop/development/django/rhombus2/rhombus/
<VirtualHost *:80>
ServerName myrhobmus.com
ServerAlias www.myrhombus.com
WSGIScriptAlias / /home/avlahop/development/django/rhombus2/rhombus/rhombus/wsgi.py
</VirtualHost>在创建了conf文件之后,我运行了a2ensite Ubuntu命令来启用站点。
将WSGIPythonPath放入VirtualHost中会给出一个apache configtest failure inside指令在目录内(如示例中所述)会产生同样的故障
如果我去www.myrhombus.com,我得到一条Google chrome找不到指定地址的消息。
我做错了什么?互联网上的每个教程都在使用旧的file.wsgi,而现在Django为您创建了这个文件,但它是一个带有.py扩展名的python文件。我如何在apache中使用我的django?如果我想在我自己的服务器上进行生产,你会把django代码放在哪里,把模板文件放在哪里?
编辑:我只得到了/页的索引。在权限方面,我是否需要对mysites的位置做些什么?你能给我一个django站点apache conf文件的工作示例吗?
发布于 2015-11-26 12:37:10
我使用了Django 1.8,并且成功地部署了我的项目Apache服务器。我遵循了像你一样的基本概念,很早就启用了Apache这个模块。
你可以在我的项目中提出这个问题。Refer this question to understand project structure
-这是我的虚拟主机文件
WSGIPythonPath /home/umayanga/Desktop/view_site/serialKey_gen_site:/home/umayanga/Desktop/view_site/serialKey_gen_site/myvenv/lib/python3.4/site$
<VirtualHost *:80>
ServerAdmin admin@key.com
ServerName key.com
ServerAlias www.key.com
Alias /templates/ /home/umayanga/Desktop/view_site/serialKey_gen_site/templates/
Alias /static/ /home/umayanga/Desktop/view_site/serialKey_gen_site/static/
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/static">
Require all granted
</Directory>
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/templates">
Require all granted
</Directory>
WSGIScriptAlias / /home/umayanga/Desktop/view_site/serialKey_gen_site/mysite/wsgi.py
<Directory "/home/umayanga/Desktop/view_site/serialKey_gen_site/mysite">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>-----------------wsgi.py
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()我想这对你会有帮助的。
https://stackoverflow.com/questions/23679067
复制相似问题