LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   WSGI configuration error (https://www.linuxquestions.org/questions/programming-9/wsgi-configuration-error-4175611840/)

manolakis 08-12-2017 06:43 PM

WSGI configuration error
 
Hello,

I have a Flask application which I want to deploy in amazon ec2 ubuntu instance. The structure of the application is as follows:
Code:

/ItemCatalog/vagrant/catalog/__init__.py
/ItemCatalog/vagrant/catalog/database_setup.py
/ItemCatalog/vagrant/catalog/database_init.py

My problem is writing the WSGI script to import the applications. Mine looks like this
Code:

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/ItemCatalog/vagrant/catalog/")

import __init__ as application

Unfortunately apache2 log shows the following error.
Code:

AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 13 02:33:14.688831 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] mod_wsgi (pid=26490): Exception occurred processing WSGI script '/var/www/ItemCatalog/ItemCatalog.wsgi'.
[Sun Aug 13 02:33:14.688887 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] TypeError: 'module' object is not callable

Any help will be really appreciated.

TB0ne 08-13-2017 11:28 AM

Quote:

Originally Posted by manolakis (Post 5747632)
Hello,
I have a Flask application which I want to deploy in amazon ec2 ubuntu instance. The structure of the application is as follows:
Code:

/ItemCatalog/vagrant/catalog/__init__.py
/ItemCatalog/vagrant/catalog/database_setup.py
/ItemCatalog/vagrant/catalog/database_init.py

My problem is writing the WSGI script to import the applications. Mine looks like this
Code:

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/ItemCatalog/vagrant/catalog/")
import __init__ as application

Unfortunately apache2 log shows the following error.
Code:

AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 13 02:33:14.688831 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] mod_wsgi (pid=26490): Exception occurred processing WSGI script '/var/www/ItemCatalog/ItemCatalog.wsgi'.
[Sun Aug 13 02:33:14.688887 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] TypeError: 'module' object is not callable

Any help will be really appreciated.

Not sure what else we can help with here. The error message is pretty clear: the file you typed in can't be found/loaded. Path correct? Permissions correct? Name?

astrogeek 08-13-2017 01:10 PM

Quote:

Originally Posted by manolakis (Post 5747632)
Unfortunately apache2 log shows the following error.
Code:

AH00094: Command line: '/usr/sbin/apache2'
[Sun Aug 13 02:33:14.688831 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] mod_wsgi (pid=26490): Exception occurred processing WSGI script '/var/www/ItemCatalog/ItemCatalog.wsgi'.
[Sun Aug 13 02:33:14.688887 2017] [wsgi:error] [pid 26490:tid 140351360669440] [client 79.130.214.226:61323] TypeError: 'module' object is not callable


The error message is indeed pretty clear, what have you done to resolve that error?

If you are not sure what that error means, a quick search for "TypeError: 'module' object is not callable" turns up many useful links, including this one.

Per the Site FAQ posting guidelines, please do your own basic troubleshooting and research before asking others for help.

sundialsvcs 08-13-2017 08:16 PM

Don't you need to import vagrant after adding its location to the path?

Also, __init__.py is a normally-empty file that only serves to inform Python that the directory contains a package. Carefully check the documentation for Vagrant to see what they specify. I don't think that you're importing the right thing.


All times are GMT -5. The time now is 09:32 PM.