LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-12-2017, 06:43 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 442

Rep: Reputation: 31
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.
 
Old 08-13-2017, 11:28 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,007

Rep: Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341
Quote:
Originally Posted by manolakis View Post
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?
 
1 members found this post helpful.
Old 08-13-2017, 01:10 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,417
Blog Entries: 6

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by manolakis View Post
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.
 
Old 08-13-2017, 08:16 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,330
Blog Entries: 4

Rep: Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843Reputation: 2843
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] configuration error: Can't find Tcl configuration definition schattkab Linux - Software 3 01-28-2015 11:22 AM
Apache2, wsgi, modules Roaderrr Linux - Server 0 04-09-2014 11:44 AM
No module found (Apache2, wsgi, python) Roaderrr Linux - Server 1 04-08-2014 07:14 AM
prelink configuration error :: fatal error: ac_nonexistent.h: No such file or direct jubitaneja Linux - Software 4 04-13-2012 08:55 AM
Apache 2 -> Turbogears 2.0 wsgi -> SSL pkraus109 Linux - Server 0 12-06-2009 07:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration