How to combine Prestashop (PHP) and DjangoCMS (Python)

I need to use DjangoCMS and prestashop with the same URL, for example:

localhost/shop = prestashop<br> localhost/everythingElse = DjangoCMS<br>

my prestashop is installed in /var/www/prestashop , and djangoCMS is installed in /var/www/djangoCMS .

Linux Mint 14 64 bit, apache2, mod_python, wsgi ...

I tried this conf:

 <VirtualHost *:80> DocumentRoot "/var/www/djangoCMS" ServerName localhost WSGIScriptAlias / "/var/www/djangoCMS/djangoCMS/apache/django.wsgi" <Directory "/var/www/djangoCMS/djangoCMS/apache"> Options +ExecCGI Order allow,deny Allow from all </Directory> 

 <VirtualHost *:80> DocumentRoot "/var/www/prestashop" ServerName php.localhost <Directory "/var/www/prestashop"> Options Indexes FollowSymLinks AllowOverride None Order Deny,Allow Allow from all </Directory> 

Django works fine on localhost, but I can't access php.localhost: Oh! Google Chrome could not find php.localhost

+6
source share
1 answer

ServerName php.localhost means you tell Apache to respond to any requests made at http: //php.localhost . To do this, you will need to add php.localhost to indicate the server IP address (127.0.0.1 if this is your local development environment)

This will not work in a production environment. I suggest using ProxyPass, where you can tell apache to redirect all calls to a specific port. For instance:

 <VirtualHost *:9090> ServerName localhost DocumentRoot /var/www/prestashop <Directory "/var/www/prestashop"> AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/djangoCMS" ServerName localhost WSGIScriptAlias / "/var/www/djangoCMS/djangoCMS/apache/django.wsgi" <Directory "/var/www/djangoCMS/djangoCMS/apache"> Options +ExecCGI Order allow,deny Allow from all </Directory> ProxyPass /shop https://localhost:9090 ProxyPassReverse /shop https://localhost:9090 </virtualHost> 

So you will have a preashashop running on port 9090, django on port 80 and tell Apache to redirect all calls from http: // localhost / shop to http: // localhost: 9090

0
source

Source: https://habr.com/ru/post/946393/


All Articles