简体   繁体   English

具有apache + mod_wsgi(带有ubuntu的Amazon EC2服务器)的单个域上的Django-CMS和LFS

[英]Django-CMS and LFS on single domain with apache+mod_wsgi (amazon ec2 server with ubuntu)

I have some difficult to install multiple projects Django on a single domain. 我很难在单个域上安装多个项目Django。 I want to run Django-CMS and LFS on same domain : 我想在同一域上运行Django-CMS和LFS:

  • mydomain.com (django-cms) mydomain.com(django-cms)
  • mydomain.com/store (LFS) mydomain.com/store(LFS)

For the time being, I can access to the two domains with the correct django-project without problem however in the LFS project all shop's links redirect to the first domain. 目前,我可以使用正确的django-project访问两个域,而不会出现问题,但是在LFS项目中,所有商店的链接都重定向到第一个域。 For example, the cart link redirect to mydomain.com/cart instead of mydomain.com/store/cart . 例如,购物车链接重定向到mydomain.com/cart而不是mydomain.com/store/cart

I tried to change the url.py file by adding "store/" in all url patterns but it doesn't work. 我试图通过在所有url模式中添加“ store /”来更改url.py文件,但是它不起作用。 I think I have to add a configuration in the settings.py of the LFS project but I don't know what. 我想我必须在LFS项目的settings.py中添加一个配置,但是我不知道是什么。

Have you some ideas ? 你有什么主意吗? Thanks ! 谢谢 ! :) :)

PS: here my httpd.conf 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

Django does not always play too nicely in a subdirectory--even in a situation where it is the only Django project on the domain. Django在子目录中的表现并不总是那么好-即使在它是域中唯一的Django项目的情况下。 I had thought the docs recommend against this, but I was not able to find that page after a quick search 我原本以为文档会建议您这样做,但是经过快速搜索后却找不到该页面

One of the problems may be here: 问题之一可能在这里:

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

It would appear that this directive possibly maps all URI segments under / to this particular WSGI script, overriding the /store alias. 看来,该指令可能会将/下的所有URI段映射到该特定WSGI脚本,从而覆盖/store别名。 Reversing the order of your script aliases may or may not clear up this problem. 反转脚本别名的顺序可能会也可能不会解决此问题。

Is it possible to rethink your URL convention to offer the 'store' area from a subdomain, like store.mydomain.com/cart? 是否有可能重新考虑您的URL约定以从诸如store.mydomain.com/cart之类的子域提供“商店”区域?

If so, this may be a better supported structure and the two projects can have isolated Apache processes and WSGI scripts. 如果是这样,这可能是一个更好支持的结构,并且两个项目可以具有隔离的Apache进程和WSGI脚本。

The other solution would be to see about integrating the two projects together into a single Django project. 另一个解决方案是将两个项目集成到一个Django项目中。 I don't know what your particular use-cases are that may prevent you from going this route or what unique challenges this may present, but this may be especially helpful to users if both projects will use authentication. 我不知道您的特定用例可能会阻止您走这条路,或者可能会遇到哪些独特的挑战,但是如果两个项目都将使用身份验证,这可能对用户特别有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM