CSIRT-MU / Stream4Flow

A framework for the real-time network traffic analysis based on world-leading technologies for distributed stream processing, network traffic monitoring, and visualization.
https://csirt.muni.cz/?lang=en
MIT License
101 stars 36 forks source link

Web2py error #50

Closed tomjirsa closed 7 years ago

tomjirsa commented 7 years ago

After deploy, web2py does not work:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Log from apache:

[Mon Jul 17 13:59:44.656256 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] mod_wsgi (pid=22261): Target WSGI script '/var/www/web2py/wsgihandler.py' cannot be loaded as Python module.
[Mon Jul 17 13:59:44.656287 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] mod_wsgi (pid=22261): Exception occurred processing WSGI script '/var/www/web2py/wsgihandler.py'.
[Mon Jul 17 13:59:44.656310 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] Traceback (most recent call last):
[Mon Jul 17 13:59:44.656363 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/wsgihandler.py", line 29, in <module>
[Mon Jul 17 13:59:44.656402 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     import gluon.main
[Mon Jul 17 13:59:44.656430 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/gluon/main.py", line 121, in <module>
[Mon Jul 17 13:59:44.656482 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     load_routes()
[Mon Jul 17 13:59:44.656496 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/gluon/rewrite.py", line 319, in load
[Mon Jul 17 13:59:44.656512 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     exec(data, symbols)
[Mon Jul 17 13:59:44.656522 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "<string>", line 23, in <module>
[Mon Jul 17 13:59:44.656548 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] ImportError: No module named fileutils

Installed module fileutils

[Mon Jul 17 14:08:27.716693 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] mod_wsgi (pid=22261): Target WSGI script '/var/www/web2py/wsgihandler.py' cannot be loaded as Python module.
[Mon Jul 17 14:08:27.716798 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] mod_wsgi (pid=22261): Exception occurred processing WSGI script '/var/www/web2py/wsgihandler.py'.
[Mon Jul 17 14:08:27.716852 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] Traceback (most recent call last):
[Mon Jul 17 14:08:27.716877 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/wsgihandler.py", line 29, in <module>
[Mon Jul 17 14:08:27.716909 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     import gluon.main
[Mon Jul 17 14:08:27.716922 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/gluon/main.py", line 121, in <module>
[Mon Jul 17 14:08:27.717760 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     load_routes()
[Mon Jul 17 14:08:27.717779 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "/var/www/web2py/gluon/rewrite.py", line 319, in load
[Mon Jul 17 14:08:27.717799 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]     exec(data, symbols)
[Mon Jul 17 14:08:27.717811 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162]   File "<string>", line 23, in <module>
[Mon Jul 17 14:08:27.718432 2017] [wsgi:error] [pid 22261:tid 139642047747840] [remote 192.168.0.1:7162] ImportError: cannot import name abspath

Installed module fileutils

 sudo pip install abspath

The problem remains

tomjirsa commented 7 years ago

Something has to be changed in web2py framework.

@tomaspvk - please check deploy on your machine to confirm the bug

tomaspvk commented 7 years ago

Seems like the issue is that chgpasswd.py script cannot find gluon directory and import the necessary files from it (such as gluon.fileutils, where the abspath function is located) installing fileutils with pip is unnecessary. Adding

import sys
sys.path.append("/var/www/web2py/gluon")

to the file makes script successfully execute, however I need to test it a bit more.

tomjirsa commented 7 years ago

Checked the fix.

Error still stays the same, eventhough the chgpasswd.py contains the string:

import sys
sys.path.append("/var/www/web2py/gluon")

Apache2 error log:

[Tue Jul 18 13:22:12.951122 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920] mod_wsgi (pid=22268): Target WSGI script '/var/www/web2py/wsgihandler.py' cannot be loaded as Python module.
[Tue Jul 18 13:22:12.951394 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920] mod_wsgi (pid=22268): Exception occurred processing WSGI script '/var/www/web2py/wsgihandler.py'.
[Tue Jul 18 13:22:12.951439 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920] Traceback (most recent call last):
[Tue Jul 18 13:22:12.951480 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]   File "/var/www/web2py/wsgihandler.py", line 29, in <module>
[Tue Jul 18 13:22:12.951548 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]     import gluon.main
[Tue Jul 18 13:22:12.951623 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]   File "/var/www/web2py/gluon/main.py", line 121, in <module>
[Tue Jul 18 13:22:12.951697 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]     load_routes()
[Tue Jul 18 13:22:12.951767 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]   File "/var/www/web2py/gluon/rewrite.py", line 319, in load
[Tue Jul 18 13:22:12.951828 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]     exec(data, symbols)
[Tue Jul 18 13:22:12.951886 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920]   File "<string>", line 23, in <module>
[Tue Jul 18 13:22:12.952005 2017] [wsgi:error] [pid 22268:tid 140002263254784] [remote 192.168.0.1:40920] ImportError: No module named fileutils
tomaspvk commented 7 years ago

Commited new fix, error was in routes.py file, caused by changes in newer version of web2py