Read:

https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html
 
<https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html>
https://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html
 
<https://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html>

You don't need AddHandler or SetHandler when using WSGIScriptAlias.

Your WSGIPythonPath also looks wrong. There should not be any need to add 
directories internal to the Python distribution as you are. If they are 
required in some way, it usually indicates that your mod_wsgi isn't compiled 
for that Python installation. If that is the case and mixing Python versions, 
things will break in other ways. If your Python is in a non standard location, 
you should use WSGIPythonHome to indicate where it is.

See:

https://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#multiple-python-versions
 
<https://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#multiple-python-versions>
https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html 
<https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html>

Graham

> On 13 Mar 2019, at 9:29 am, K. W. Landry <[email protected]> wrote:
> 
> 
> For reference for anyone else running into this issue, 
> 
> Posting the contents of file Reporter.wsgi
> 
> 
> <IfModule mod_wsgi.c>
> 
>     #WSGIPythonPath directory|directory-1:directory-2:...
>     WSGIPythonPath 
> /usr/local/lib/python3.6:/usr/local/lib/python3.6/site-packages:/usr/local/lib/python3.6/lib-dynload
> 
> </IfModule>
> 
> 
> And, contents of Reporter.conf of the apache2 deploy of the Reporter app,
> 
> #WSGIRestrictEmbedded On
>     #LoadModule wsgi_module modules/mod_wsgi.so
> 
>     WSGIDaemonProcess Reports user=www-data group=www-data 
>     # processes=1 threads=3 
>     #display-name=Reports 
>     
> #python-path='/var/www/Reports/html/venv/lib/python3.7/site-packages:/var/www/Reports/html:/var/www/Reports/html/venv:/var/www/Reports/html/venv/bin:/var/www/Reports/html/venv/bin/python3.7:/var/www/Reports/html/venv/lib:/var/www/Reports/html/venv/lib/python3.7'
> 
>     WSGIApplicationGroup %{GLOBAL}
>     #WSGIPythonHome /var/www/Reports/html/venv
>     WSGIProcessGroup Reports
>     WSGIScriptAlias /Reporter /var/www/Reports/Reports.wsgi
> 
> <VirtualHost *:80>
>     ServerAdmin [email protected]
>     ServerName xxx.xxx.xxx.xxxx.compute.amazonaws.com 
> <http://xxx.xxx.xxx.xxxx.compute.amazonaws.com/>
>     ServerAlias xxx.xxx.xxx.xxxx.compute.amazonaws.com 
> <http://xxx.xxx.xxx.xxxx.compute.amazonaws.com/>
>     DocumentRoot /var/www/Reports
>     
>     #Alias "/Reports/assets/" "/var/www/Reports/html/assets"
>     #Alias static/ /var/www/Reports/html/static
>     #Alias /static/ /var/www/Reports/html/static
>     
>     #ErrorLog ${APACHE_LOG_DIR}/error.log
>     #CustomLog ${APACHE_LOG_DIR}/access.log combined
>     ErrorLog /var/www/Reports/error.log
>     CustomLog /var/www/Reports/access.log combined
> 
>     <Directory /var/www/Reports>
>         Order allow,deny
>         AllowOverride All
>           Allow from all
>           Require all granted
>         Options ExecCGI
>         SetHandler wsgi-script
>         AddHandler cgi-script .cgi
>         AddHandler wsgi-script .wsgi
>         PassEnv LANG
>     </Directory>
> 
> </VirtualHost>
> 
> 
> On Tue, Mar 12, 2019 at 9:24 PM K. W. Landry <[email protected] 
> <mailto:[email protected]>> wrote:
> Thank you Graham, especially for the quick reply but also, yes, in fact I am 
> using SetHandler (struggled a bit to get it working 
> (ubuntu/apache2/python367/plotly/Dash) and this was what finally got it 
> working. 
> I'll go back and work through that, but also post the config for others as a 
> reference, 
> 
> Thanks, 
> KWL 
>  
> 
> On Tue, Mar 12, 2019 at 9:05 PM Graham Dumpleton <[email protected] 
> <mailto:[email protected]>> wrote:
> Need to see your Apache configuration for mod_wsgi, but it looks like you 
> used SetHandler to map wsgi-script to a directory containing them. You would 
> rarely use SetHandler or AddHandler when setting up mod_wsgi. Use them and do 
> it wrong and it could cause issues like this.
> 
> Graham
> 
>> On 13 Mar 2019, at 9:02 am, KWL <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi Folks, 
>> 
>> Have searched doc and others postings, on every search term I can think of 
>> to run this down, but have not found why this is happening. 
>> 
>> Why is WSGI parsing and validating the CSS and .js files in the assets 
>> directory, and throwing invalid syntax errors, and when the syntax is 
>> perfectly fine? 
>> 
>> I know Dash looks in the assets directory for statics, for css and js, but 
>> then, again why are these files being flagged, and why when they are 
>> perfectly valid css and js files? 
>> 
>> [wsgi:error] Attempt to invoke directory as WSGI application: 
>> /var/www/Reports/
>> [wsgi:error] Attempt to invoke directory as WSGI application: 
>> /var/www/Reports/
>> [wsgi:info] [mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Loading WSGI script '/var/www/Reports/assets/stylesheet.css'.
>> [wsgi:error]  mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Failed to parse WSGI script file '/var/www/Reports/assets/stylesheet.css'.
>> [wsgi:error]  mod_wsgi (pid=24436): Exception occurred processing WSGI 
>> script '/var/www/Reports/assets/stylesheet.css'.
>> [wsgi:error]    File "/var/www/Reports/assets/stylesheet.css", line 1
>> [wsgi:error]      /*
>> [wsgi:error]      ^
>> [wsgi:error]  SyntaxError: invalid syntax
>> [wsgi:info]  [mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Loading WSGI script '/var/www/Reports/assets/stylesheet2.css'.
>> [wsgi:error]  mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Failed to parse WSGI script file '/var/www/Reports/assets/stylesheet2.css'.
>> [wsgi:error]  mod_wsgi (pid=24436): Exception occurred processing WSGI 
>> script '/var/www/Reports/assets/stylesheet2.css'.
>> [wsgi:error]    File "/var/www/Reports/assets/stylesheet2.css", line 1
>> [wsgi:error]      /*
>> [wsgi:error]      ^
>> [wsgi:error]  SyntaxError: invalid syntax
>> [wsgi:info]  [mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Loading WSGI script '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]  mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Failed to parse WSGI script file '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]  mod_wsgi (pid=24436): Exception occurred processing WSGI 
>> script '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]    File "/var/www/Reports/assets/plotly_ga.js", line 1
>> [wsgi:error]      
>> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
>> [wsgi:error]                              ^
>> [wsgi:error]  SyntaxError: invalid syntax
>> [wsgi:info]  [mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Loading WSGI script '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]  mod_wsgi (pid=24436, process='HelloWorld', application=''): 
>> Failed to parse WSGI script file '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]  mod_wsgi (pid=24436): Exception occurred processing WSGI 
>> script '/var/www/Reports/assets/plotly_ga.js'.
>> [wsgi:error]    File "/var/www/Reports/assets/plotly_ga.js", line 1
>> [wsgi:error]      
>> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
>> [wsgi:error]                              ^
>> [wsgi:error]  SyntaxError: invalid syntax
>> [wsgi:error]  Attempt to invoke directory as WSGI application: 
>> /var/www/Reports/
>> [mpm_event:notice] AH00493: SIGUSR1 received.  Doing graceful restart
>> 
>> Thanks,
>> KWL
>> 
>> -- 
>> 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] 
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected] 
>> <mailto:[email protected]>.
>> Visit this group at https://groups.google.com/group/modwsgi 
>> <https://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <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 https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to