Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用apache+;mod_wsgi(带有ubuntu的amazon ec2服务器)_Python_Django_Apache_Django Lfs - Fatal编程技术网

Python 使用apache+;mod_wsgi(带有ubuntu的amazon ec2服务器)

Python 使用apache+;mod_wsgi(带有ubuntu的amazon ec2服务器),python,django,apache,django-lfs,Python,Django,Apache,Django Lfs,我有一些很难在一个域上安装多个项目Django。我想在同一个域上运行Django CMS和LFS: mydomain.com(django cms) mydomain.com/store(LFS) 目前,我可以使用正确的django项目访问这两个域,没有问题,但是在LFS项目中,所有商店的链接都重定向到第一个域。例如,购物车链接重定向到mydomain.com/cart,而不是mydomain.com/store/cart 我试图通过在所有url模式中添加“store/”来更改url.py文

我有一些很难在一个域上安装多个项目Django。我想在同一个域上运行Django CMS和LFS:

  • mydomain.com(django cms)
  • mydomain.com/store(LFS)
目前,我可以使用正确的django项目访问这两个域,没有问题,但是在LFS项目中,所有商店的链接都重定向到第一个域。例如,购物车链接重定向到mydomain.com/cart,而不是mydomain.com/store/cart

我试图通过在所有url模式中添加“store/”来更改url.py文件,但没有成功。 我想我必须在LFS项目的settings.py中添加一个配置,但我不知道是什么

你有什么想法吗? 谢谢!:)

PS:这是我的httpd.conf

Alias /store/static /home/ubuntu/lfs-installer/lfs_project/sitestatic/

<Directory /home/ubuntu/lfs-installer/lfs_project/sitestatic>
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias /store /home/ubuntu/lfs-installer/apache/django.wsgi


Alias /static /home/ubuntu/lfs-installer/selmyrtech/static/

<Directory /home/ubuntu/lfs-installer/selmyrtech/static>
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias / /home/ubuntu/lfs-installer/selmyrtech/apache/django.wsgi
Alias/store/static/home/ubuntu/lfs安装程序/lfs\u项目/sitestic/
命令拒绝,允许
通融
WSGIScriptAlias/store/home/ubuntu/lfs安装程序/apache/django.wsgi
别名/static/home/ubuntu/lfs安装程序/selmyrtech/static/
命令拒绝,允许
通融
WSGIScriptAlias//home/ubuntu/lfs installer/selmyrtech/apache/django.wsgi

Django在子目录中的表现并不总是很好——即使在它是域中唯一的Django项目的情况下也是如此。我原以为医生建议不要这样做,但我在快速搜索后找不到该页面

其中一个问题可能是:

WSGIScriptAlias / /home/ubuntu/lfs-installer/selmyrtech/apache/django.wsgi
似乎该指令可能将
/
下的所有URI段映射到此特定WSGI脚本,从而覆盖
/store
别名。颠倒脚本别名的顺序可能会或可能不会解决此问题

是否可以重新考虑您的URL约定,从子域(如store.mydomain.com/cart)提供“存储”区域

如果是这样,这可能是一个更好的支持结构,两个项目可以有独立的Apache进程和WSGI脚本


另一个解决方案是考虑将两个项目集成到一个Django项目中。我不知道您的特定用例是什么,可能会阻止您走这条路,或者这可能会带来什么独特的挑战,但如果两个项目都使用身份验证,这可能对用户特别有帮助。

谢谢您的回复。我考虑过一个新的URL约定,但我想知道是否还有其他解决方案。对于第二个解决方案,我更喜欢使用两个不同的Django项目,因为当您使用LFS时,Django管理员会对LFS的许多选项产生阻碍。无论如何,谢谢你的帮助;)