This isn't what I told you to use at all, it is actually the complete opposite.
I serious think I need to give up, so this is my last attempt.
Can you try what I asked you to?
Specifically, in the last email I told you to get rid of WSGIScriptAlias. Add
in a redirect but scoped to exact URL of '/' only and use AddHandler again,
with DocumentRoot.
<VirtualHost *:80>
ServerName www.healthcare.in
ServerAlias healthcare.in
ServerAdmin webmaster@localhost
WSGIDaemonProcess healthcare.in processes=6 threads=15 display-name=%{GROUP}
WSGIProcessGroup healthcare.in
# Redirect only URL for the very root of the site. Send the browser to index.py
instead.
<LocationMatch '^/$'>
RedirectTemp / http://www.healthcare.in/index.py
</LocationMatch>
# Have DocumentRoot be where code is, but be warned this can be high insecure
unless you scrub that directory of sensitive files and editor backup files.
DocumentRoot /home/nitin/wsgi-scripts
# For the code directory, have .py files interpreted as WSGi script files. Any
other static assets in that directory should be served up as per normal.
<Directory /home/nitin/wsgi-scripts>
Options ExecCGI
AddHandler wsgi-script .py
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
You will of course need to put back all your URLs in your code because you went
off and stick WSGIScriptAlias in at a sub URL which wasn't what I said to do.
Also pay head to the comment I made about WSGIApplicationGroup, or if you had
no idea what I was talking about and memory usage is not a concern, don't
bother and ignore what I said about it as it likely is just going to confuse
you more and you will have problems later when you code doesn't work because it
isn't designed to work in same sub interpreter with other code.
Graham
On 27/01/2015, at 7:12 AM, nitin chandra <[email protected]> wrote:
> Thanks :)
>
> I am on ApAcHe 2.4. In this , as per your previous mail, the
> Directives have changed. So I find the Current Directive suggested in
> conflict to the previous suggestion.
>
> my current config below:-
>
> <VirtualHost *:80>
> ServerName www.healthcare.in
> ServerAlias healthcare.in
> ServerAdmin webmaster@localhost
> DocumentRoot /var/www/html
> WSGIDaemonProcess healthcare.in processes=6 threads=15 display-name=%{GROUP}
> WSGIProcessGroup healthcare.in
> WSGIScriptAlias /wsgi-scripts /home/nitin/wsgi-scripts/ {=> modified
> this line to this}
> <Directory /home/nitin/wsgi-scripts>
> Require all granted
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> </VirtualHost>
>
> After, the above modification, I had to add, to all links, the
> "wsgi-scripts" path in the html/python webpage. The very thing you
> wanted to know, Do I want it in the path or not?
>
> Now I have the application working. Happened about 5 Hr back. I logged
> in late to my ID today. Sorry in replying late.
>
> Now I had to resort to using the web link to access the jquery date
> picker. I am getting WSGI / JS error, pasted below the image error. A
> little help will be REALLY appreciated. My demo will be ready to
> ...... Demo :) .
>
> Just did that, but funny thing is my images in the image directory are
> not read and apache error log gives
>
> ===========================================================================================
> [Mon Jan 26 18:29:51.561697 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] mod_wsgi (pid=6371): Exception occurred processing
> WSGI script '/home/nitin/wsgi-scripts/calimgs/present.png'.
> [Mon Jan 26 18:29:51.561839 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] File
> "/home/nitin/wsgi-scripts/calimgs/present.png", line 1
> [Mon Jan 26 18:29:51.561854 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] SyntaxError: Non-ASCII character '\\x89' in file
> /home/nitin/wsgi-scripts/calimgs/present.png on line 1, but no
> encoding declared; see http://www.python.org/peps/pep-0263.html for
> details
> [Mon Jan 26 18:29:51.586756 2015] [:error] [pid 6788] [remote
> 127.0.0.1:30471] mod_wsgi (pid=6788, process='healthcare.in',
> application='www.healthcare.in|/wsgi-scripts/calimgs/coming.png'):
> Failed to parse WSGI script file
> '/home/nitin/wsgi-scripts/calimgs/coming.png'.
> [Mon Jan 26 18:29:51.586801 2015] [:error] [pid 6788] [remote
> 127.0.0.1:30471] mod_wsgi (pid=6788): Exception occurred processing
> WSGI script '/home/nitin/wsgi-scripts/calimgs/coming.png'.
> [Mon Jan 26 18:29:51.586860 2015] [:error] [pid 6788] [remote
> 127.0.0.1:30471] File "/home/nitin/wsgi-scripts/calimgs/coming.png",
> line 1
> [Mon Jan 26 18:29:51.586873 2015] [:error] [pid 6788] [remote
> 127.0.0.1:30471] SyntaxError: Non-ASCII character '\\x89' in file
> /home/nitin/wsgi-scripts/calimgs/coming.png on line 1, but no encoding
> declared; see http://www.python.org/peps/pep-0263.html for details
>
> =============================================================================================
>
> for development I had also installed the Jquery locally. Currently JS
> and CSS are also not getting read properly, gives error as below
>
> ====================================================================================================
> [Mon Jan 26 18:29:51.538164 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] File
> "/home/nitin/wsgi-scripts/jquery-ui-1.8.15.custom/js/jquery-ui-1.8.15.custom.min.js",
> line 1
> [Mon Jan 26 18:29:51.538172 2015] [:error] [pid 6371] [remote
> 127.0.0.1:1040] ^
> [Mon Jan 26 18:29:51.538177 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] /*!
> [Mon Jan 26 18:29:51.538181 2015] [:error] [pid 6371] [remote
> 127.0.0.1:1040] SyntaxError: invalid syntax
> [Mon Jan 26 18:29:51.538184 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] ^
> [Mon Jan 26 18:29:51.538201 2015] [:error] [pid 6371] [remote
> 127.0.0.1:30471] SyntaxError: invalid syntax
> [Mon Jan 26 18:29:51.545347 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] mod_wsgi (pid=6512, process='healthcare.in',
> application='www.healthcare.in|/wsgi-scripts/fullcalendar-1.5.1/fullcalendar/fullcalendar.css'):
> Failed to parse WSGI script file
> '/home/nitin/wsgi-scripts/fullcalendar-1.5.1/fullcalendar/fullcalendar.css'.
> [Mon Jan 26 18:29:51.545396 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] mod_wsgi (pid=6512): Exception occurred processing
> WSGI script
> '/home/nitin/wsgi-scripts/fullcalendar-1.5.1/fullcalendar/fullcalendar.css'.
> [Mon Jan 26 18:29:51.545505 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] File
> "/home/nitin/wsgi-scripts/fullcalendar-1.5.1/fullcalendar/fullcalendar.css",
> line 1
> [Mon Jan 26 18:29:51.545518 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] /*
> [Mon Jan 26 18:29:51.545527 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] ^
> [Mon Jan 26 18:29:51.545532 2015] [:error] [pid 6512] [remote
> 127.0.0.1:30471] SyntaxError: invalid syntax
> [Mon Jan 26 18:29:51.549246 2015] [:error] [pid 6815] [remote
> 127.0.0.1:44831] mod_wsgi (pid=6815, process='healthcare.in',
> application='www.healthcare.in|/wsgi-scripts/fullcalendar-1.5.1/jquery/jquery-1.5.2.min.js'):
> Failed to parse WSGI script file
> '/home/nitin/wsgi-scripts/fullcalendar-1.5.1/jquery/jquery-1.5.2.min.js'.
> [Mon Jan 26 18:29:51.549319 2015] [:error] [pid 6815] [remote
> 127.0.0.1:44831] mod_wsgi (pid=6815): Exception occurred processing
> WSGI script
> '/home/nitin/wsgi-scripts/fullcalendar-1.5.1/jquery/jquery-1.5.2.min.js'.
>
> ====================================================================================
>
> Nitin
>
>
> On 26 January 2015 at 11:52, Graham Dumpleton
> <[email protected]> wrote:
>> So lets start first then with redirection.
>>
>> If you use the directive Redirect, RedirectTemp or RedirectPermanent the
>> problem is that the URL path is used as a prefix when matching, so if you
>> use:
>>
>> RedirectTemp / http://www.healthcare.in/index.py
>>
>> then it will redirect every URL of the site and when it comes back to the
>> site on the redirected request, it hits the redirect again and causes a
>> loop. This therefore cannot be used.
>>
>> A way around the redirect loop is to apply the directive to just the
>> specific path of '/'. This can be done using:
>>
>> <LocationMatch '^/$'>
>> RedirectTemp / http://www.healthcare.in/index.py
>> </LocationMatch>
>>
>> You could also have used mod_rewrite, but this is probably simpler.
>>
>> Next we need to have files with a .py extension handled as WSGI application
>> script files. This is done using Options ExecCGI and AddHandler as you were
>> doing. Thus something like:
>>
>> <Directory /home/nitin/wsgi-scripts>
>> Options ExecCGI
>> AddHandler wsgi-script .py
>> Order allow,deny
>> Allow from all
>> </Directory>
>>
>> That should be enough. Get rid of the WSGIScriptAlias directive you had.
>>
>> BTW, do note that because you are using AddHandler, each of the WSGI script
>> files will run in its own separate sub interpreter. If you don't want that
>> and they can and should run in the same Python sub interpreter context, you
>> should also be setting:
>>
>> WSGIApplicationGroup %{GLOBAL}
>>
>> Graham
>>
>> On 24/01/2015, at 8:44 AM, nitin chandra <[email protected]> wrote:
>>
>>> Most of the time I have followed index.html / index.py as the first
>>> page of the web page. So, when I '/' to redirect to '/index.py', I
>>> mean to load the index.py as the first page of the application.
>>>
>>> So should I do "/wsgi-scripts/ /home/nitin/wsgi-scripts/" ?
>>>
>>> Thx
>>>
>>> Nitin
>>>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.