I am facing a wsgi exception while running my flask application code in the server.
Here is my manage.py
from app import app1, db
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
migrate = Migrate(app1, db)
manager = Manager(app1)
manager.add_command('db', MigrateCommand)
def make_shell_context():
return dict(app=app1, db=db)
manager.add_command("shell", Shell(make_context=make_shell_context))
if __name__ == '__main__':
manager.run()
and app.py
app1 = Flask(__name__)
app1.config.from_object(config['default'])
rest_api = Api(app1)
db = SQLAlchemy(app1)
bcrypt = Bcrypt(app1)
from app import routes
Compress(app1)
assets = Environment(app1)
define_assets(assets)
cache = Cache(app1,config={'CACHE_TYPE': 'simple'})
In my local, there is no error. I run my application with this python manage.py runserver
command.
Now, In the server I successfully done this steps python manage.py db init
, python manage.py db migrate
, python manage.py db upgrade
and it created, updated Database successfully. I have installed passenger
to serve the application.
My passenger_wsgi.py
looks like this
from manage import manager as application
Now, when I run passenger start --port 3003 -a '0.0.0.0'
, It throws me this error
[ 2016-08-16 07:44:15.0758 30180/7f90226f8700 age/Cor/Con/InternalUtils.cpp:112 ]: [Client 2-1] Sending 502 response: application did not send a complete response
App 30251 stderr: Traceback (most recent call last):
App 30251 stderr: File "/usr/share/passenger/helper-scripts/wsgi-loader.py", line 163, in main_loop
App 30251 stderr: socket_hijacked = self.process_request(env, input_stream, client)
App 30251 stderr: File "/usr/share/passenger/helper-scripts/wsgi-loader.py", line 297, in process_request
App 30251 stderr: result = self.app(env, start_response)
App 30251 stderr: TypeError: __call__() takes at most 2 arguments (3 given)