0

I was trying to deploy website with uwsgi + pypy + flask. Failed with uwsgi error message as below:

*** no app loaded. GAME OVER ***

My Environment and scripts are:

$ uname -a
Linux xxxxx 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux

$ pypy --version
Python 2.7.10 (3360adbeba4a, Apr 19 2016, 13:27:10)
[PyPy 5.1.0 with GCC 4.6.3]

$ uwsgi --version
1.9.17.1-debian

Note: the uwsgi is installed with pip in pypy virtualenv

flasktest.py:

from flask import Flask

application = Flask(__name__)

@application.route("/")
def hello():
    return "Hello!"

The command to run website

$ uwsgi --chmod-socket=777 \
--chdir /path/mysite --pypy-wsgi flasktest \
--master --socket 127.0.0.1:8000 --need-app

Anyone have any idea that in which part I did wrong?

1 Answers1

-2

http://flask.pocoo.org/docs/0.10/deploying/uwsgi/

Please make sure in advance that any app.run() calls you might have in your application file are inside an if name == 'main': block or moved to a separate file. Just make sure it’s not called because this will always start a local WSGI server which we do not want if we deploy that application to uWSGI.

Starting your app with uwsgi

uwsgi is designed to operate on WSGI callables found in python modules.

Given a flask application in myapp.py, use the following command:

$ uwsgi -s /tmp/uwsgi.sock --module myapp --callable app

Or, if you prefer:

$ uwsgi -s /tmp/uwsgi.sock -w myapp:app

The example:

from flask import Flask
application = Flask(__name__)

@application.route("/")
def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

if __name__ == "__main__":
    application.run(host='0.0.0.0')
Valeriy Solovyov
  • 5,384
  • 3
  • 27
  • 45
  • Thanks for the reply but still not working. Since I am using pypy, the argument '-w' you mean '--pypy-wsgi', isn't it? – tantrumiok Apr 24 '16 at 04:54