Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-22 Thread utest342
Yes, Graham, you're absolutely right about '/'! It must be there! My bad!

So, here is the final variant of .conf file with two Django sites:


WSGIRestrictEmbedded On



WSGIDaemonProcess site1 python-path=/home/user/site1 
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
process-group=site1 application-group=%{GLOBAL}

 Alias /site1/static /home/user/site1/static

  Require all granted


 
   
 
Require all granted
 



WSGIDaemonProcess site2 python-path=/home/user/site2 
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
process-group=site2 application-group=%{GLOBAL}

  Alias /site2/static /home/user/site2/static

  Require all granted



 
 
Require all granted
 





Then we need to access site1/site1/settings.py and change the value of 
STATIC_URL to '/site1/static/'.
In site2/site2/settings.py we change the value of STATIC_URL to 
'/site2/static/' respectively.

After these corrections both sites will be working correctly!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-22 Thread utest342
Yes, Graham, you're absolutely right about '/'! It must be there! My bad!

So, here is the final correct variant of .conf file with two Django sites:
==

WSGIRestrictEmbedded On



WSGIDaemonProcess site1 python-path=/home/user/site1 
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
process-group=site1 application-group=%{GLOBAL}

 Alias /site1/static /home/user/site1/static

  Require all granted


 


 
Require all granted
 


WSGIDaemonProcess site2 python-path=/home/user/site2 
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
process-group=site2 application-group=%{GLOBAL}

  Alias site2/static /home/user/site2/static


  Require all granted



 
 
Require all granted
 





Then we need to access site1/site1/settings.py and change the value of 
STATIC_URL to '/site1/static/'.
In site2/site2/settings.py we change the value of STATIC_URL to 
'/site2/static/' respectively.

After these corrections both sites will be working correctly!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-21 Thread Graham Dumpleton
Yeah, forgot to check the /static. See note below though.

> On 21 Feb 2019, at 11:52 pm, utest...@gmail.com wrote:
> 
> Yes, now both sites are working! Thank you very much for your help, Graham!
> 
> For those who will have similar situation as mine here is additional info. 
> 
> After I've corrected .conf file as Graham had advised me, I ran into another 
> problem: site1 works correctly, site2 loads without static files, although I 
> have ones.
> 
> In order to fix this problem we need to change a bit .conf file again:
> =
> 
>  WSGIRestrictEmbedded On
> 
> 
> 
> WSGIDaemonProcess site1 python-path=/home/user/site1 
> python-home=/home/user/site1/venv1
> WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
> process-group=site1 application-group=%{GLOBAL}
> 
>   Alias site1/static /home/user/site1/static

Just make sure using:

Alias /site1/static /home/user/site1/static

That is, the first argument should start with '/'. Not sure if this was just an 
oversight in masking any details didn't want to show, or is what you actually 
have. It could be that Apache works without the slash, but recommend ensuring 
you have it.

BTW, on the issue of running multiple sites and requests getting mixed up, also 
worthwhile reading:

http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html 


Graham

> 
> 
>   Require all granted
> 
> 
>  
> 
> 
>  
> Require all granted
>  
> 
> 
> WSGIDaemonProcess site2 python-path=/home/user/site2 
> python-home=/home/user/site2/venv2
> WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
> process-group=site2 application-group=%{GLOBAL}
> 
>   Alias site2/static /home/user/site2/static
> 
> 
>   Require all granted
> 
> 
> 
>  
>  
> Require all granted
>  
> 
> 
> 
> 
> 
> Then we need to access site1/site1/settings.py and change the value of 
> STATIC_URL to '/site1/static/'.
> In site2/site2/settings.py we change the value of STATIC_URL to 
> '/site2/static/' respectively.
> 
> After these corrections both sites will be working correctly!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to modwsgi+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to modwsgi@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-21 Thread utest342
Yes, now both sites are working! Thank you very much for your help, Graham!

For those who will have similar situation as mine here is additional info. 

After I've corrected .conf file as Graham had advised me, I ran into 
another problem: site1 works correctly, site2 loads without static files, 
although I have ones.

In order to fix this problem we need to change a bit .conf file again:
=

 WSGIRestrictEmbedded On



WSGIDaemonProcess site1 python-path=/home/user/site1 
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
process-group=site1 application-group=%{GLOBAL}

  Alias site1/static /home/user/site1/static


  Require all granted


 


 
Require all granted
 


WSGIDaemonProcess site2 python-path=/home/user/site2 
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
process-group=site2 application-group=%{GLOBAL}

  Alias site2/static /home/user/site2/static


  Require all granted



 
 
Require all granted
 





Then we need to access site1/site1/settings.py and change the value of 
STATIC_URL to '/site1/static/'.
In site2/site2/settings.py we change the value of STATIC_URL to 
'/site2/static/' respectively.

After these corrections both sites will be working correctly!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-21 Thread utest342
Yes, now both sites are working! Thank you very much for your help, Graham!

For those who will have similar situation as mine here is additional info. 

After I've corrected .conf file as Graham had advised me, I ran into 
another problem: site1 works correctly, site2 loads without static files, 
although I have ones.

In order to fix this problem we need to change a bit .conf file again:
=

 WSGIRestrictEmbedded On



WSGIDaemonProcess site1 python-path=/home/user/site1 
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
process-group=site1 application-group=%{GLOBAL}

  Alias site1/static /home/user/site1/static

  Require all granted


 
 
Require all granted
 


WSGIDaemonProcess site2 python-path=/home/user/site2 
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
process-group=site2 application-group=%{GLOBAL}

  Alias site2/static /home/user/site2/static

  Require all granted


 
 
Require all granted
 





Then we need to access site1/site1/settings.py and change the value of 
STATIC_URL to 'site1/static/'.
In site2/site2/settings.py we change the value of STATUC_URL to  
'site2/static/' respectively.

After these corrections both sites will be working correctly!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


Re: [modwsgi] Multiple Django Sites. Apache2. Mod_wsgi.

2019-02-19 Thread Graham Dumpleton
Unless you set ServerName in each VirtualHost with a different host name, and 
access them as different host name in URL, you will need to have both sites at 
the separate sub URLs defined in the same VirtualHost, not separate ones.

WSGIRestrictEmbedded On



WSGIDaemonProcess site1 python-path=/home/user/site1 
python-home=/home/user/site1/venv1
WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py 
process-group=site1 application-group=%{GLOBAL}

  Alias /static /home/user/site1/static

  Require all granted


 
 
Require all granted
 


WSGIDaemonProcess site2 python-path=/home/user/site2 
python-home=/home/user/site2/venv2
WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py 
process-group=site2 application-group=%{GLOBAL}

  Alias /static /home/user/site2/static

  Require all granted


 
 
Require all granted
 




> On 20 Feb 2019, at 5:27 am, utest...@gmail.com wrote:
> 
> Hi, 
> 
> I have deployed two Django sites on apache server with mod_wsgi. When I 
> enable site1.conf and site2.conf separately, my sites work correctly. But 
> when I enable both site1.conf and site2.conf, then site1 shows error "404 Not 
> Found: The requested URL /site1 was not found on this server." and site2 
> still works correctly!
> 
> I guess the problem is in .conf files. Here is my 
> /etc/apache2/sites-available/site1.conf
> ==
> 
> 
>   Alias /static /home/user/site1/static
> 
>   Require all granted
> 
> 
>  
>  
> Require all granted
>  
> 
> 
> 
> WSGIScriptAlias /site1 /home/user/site1/site1/wsgi.py
> WSGIDaemonProcess site1 python-path=/home/user/site1 
> python-home=/home/user/site1/venv1
> WSGIProcessGroup site1
> 
> 
> ==
> 
> And here is my etc/apache2/sites-available/site2.conf
> ==
> 
> 
>   Alias /static /home/user/site2/static
> 
>   Require all granted
> 
> 
>  
>  
> Require all granted
>  
> 
> 
> 
> WSGIScriptAlias /site2 /home/user/site2/site2/wsgi.py
> WSGIDaemonProcess site2 python-path=/home/user/site2 
> python-home=/home/user/site2/venv2
> WSGIProcessGroup site2
> 
> 
> 
> 
> So, what is wrong?
> 
> I'm a beginning programmer and that's my first deployment experience.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to modwsgi+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to modwsgi@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/modwsgi 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.