【发布时间】:2011-11-20 23:50:02
【问题描述】:
我有两个 Django 应用程序(appsystem 和 testapp)在不同的文件夹中运行,它们在同一个 apache 虚拟主机设置中启用(请参阅最后的 conf 文件)。
一个应用程序在域的根目录上显示一个页面,并且该页面似乎总是可以正常工作,但是当我转到应该转到第二个应用程序的 URL 时,它第一次失败并抱怨它找不到尽管我可以在加载正确设置的调试页面中看到数据库表。
如果我刷新页面,那么它 (testapp) 可以正常工作并继续运行,直到我从 appsytem 返回页面。如果我这样做并返回 testapp,我必须刷新页面。
两个应用程序都使用 sqlite 进行身份验证,但从 appsystem 的设置文件中删除身份验证和 sqlite 引用似乎并没有什么不同。
我这样做的原因是因为这个想法是显示根页面(以及一些具有唯一 URL 的管理页面)的应用程序将列出已安装的其他 django 应用程序并显示链接以单击。
我还怀疑它可能与会话相关,因为我可以在另一个浏览器中直接进入 testapp,即使在第一个实例上它也可以正常工作。因此,我确实为每个 django 应用程序赋予了自己的 SESSION_COOKIE_NAME 值,但这似乎没有帮助。
有人知道问题可能是什么吗?
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /app_www_root
RewriteEngine On
# the root of the box should show the system index - a list of installed apps
RewriteRule ^/$ /appsystem/system_index/ [PT]
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /app_www_root/>
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Include /etc/apache2/installed-apps/
## this is what gets pulled in by the include ##
Alias /testapp/static /testapp/static
Alias /testapp/logs /var/log/testapp
WSGIScriptAliasMatch ^/testapp /testapp/django.wsgi
<Directory "/testapp">
Order allow,deny
Allow from all
</Directory>
<Directory "/var/log/testapp">
Order allow,deny
Allow from all
</Directory>
<Location "/testapp/logs">
SetHandler none
Options +Indexes
</Location>
<Location "/testappl/static">
SetHandler none
Options -Indexes
Options +Includes
AddOutputFilter INCLUDES .html
</Location>
## end of included file ##
# wsgi docs advise against trailing slash below
WSGIScriptAlias /appsystem /app_sys/django.wsgi
</VirtualHost>
【问题讨论】:
标签: python django apache mod-wsgi virtualhost