我有一个叫做localdjangosite.com的网站,我已经有一个django应用程序在url localdjangosite.com/site1/的域名上运行。为此,我在apache sites-available目录中设置了一个虚拟主机,如下所示,我也使用了mod_wsgi。
WSGIScriptAlias /site1 /path/to/the/django/codebase/wsgi.py
<Directory /path/to/the/django/codebase/>
Require all granted
</Directory>正因为如此,site1运行得很好。
现在,我想在同一个域下多一个站点,比如localdjangosite.com/site2/。当我尝试像下面这样配置apache时,我遇到了page错误。
WSGIScriptAlias /site2 /path/to/the/django/codebase/for/site2/wsgi.py
<Directory /path/to/the/django/codebase/for/site2/>
Require all granted
</Directory>当我这样配置并访问url localdjangosite.com/site2/时,它显示页面未找到错误,并显示site1而不是site2的url配置。在这里,site1和site2实际上是两个不同的django项目,它们内部有不同的应用程序,服务于不同的用途。
所以我真的不明白这是怎么回事?怎么啦?
有没有人能帮我理解一下,在同一个域名下托管两个或更多的django项目?
发布于 2020-10-08 02:15:31
可以,只需使用不同的端口,例如:localdjangosite.com:80和localdjangosite.com:84
https://stackoverflow.com/questions/64243957
复制相似问题