I have tried to deploy tool-my-first-flask-oauth-tool on my tool qrcode-generator. These were the steps that I followed.
Jay-Prakash:~ administrator$ ssh jayprakash12345@login.tools.wmflabs.org jayprakash12345@tools-sgebastion-07:~$ become qrcode-generator tools.qrcode-generator@tools-sgebastion-07:~$ mkdir -p $HOME/www/python tools.qrcode-generator@tools-sgebastion-07:~$ git clone https://phabricator.wikimedia.org/source/tool-my-first-flask-oauth-tool.git $HOME/www/python/src tools.qrcode-generator@tools-sgebastion-07:~$ webservice --backend=kubernetes python shell tools.qrcode-generator@interactive:~$ touch $HOME/www/python/src/config.yaml tools.qrcode-generator@interactive:~$ chmod u=rw,go= $HOME/www/python/src/config.yaml tools.qrcode-generator@interactive:~$ cat > $HOME/www/python/src/config.yaml << EOF SESSION_COOKIE_PATH: /qrcode-generator SECRET_KEY: $(python -c "import os; print repr(os.urandom(24))") CONSUMER_KEY: Key_from_Meta CONSUMER_SECRET: Secret_from_Meta EOF tools.qrcode-generator@tools-sgebastion-07:~$ webservice --backend=kubernetes python start
Now The tool has up. But When I tried to login, I get the Internal Server Error. I get these logs from uwsgi.log
*** Operational MODE: preforking *** mounting /data/project/qrcode-generator/www/python/src/app.py on /qrcode-generator WSGI app 0 (mountpoint='/qrcode-generator') ready in 8 seconds on interpreter 0x200a330 pid: 1 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 1) spawned uWSGI worker 1 (pid: 8, cores: 1) spawned uWSGI worker 2 (pid: 9, cores: 1) spawned uWSGI worker 3 (pid: 10, cores: 1) spawned uWSGI worker 4 (pid: 11, cores: 1) [pid: 8|app: 0|req: 1/1] 192.168.180.0 () {40 vars in 1212 bytes} [Thu Jun 20 08:34:43 2019] GET /qrcode-generator/ => generated 4364 bytes in 44 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0) [pid: 9|app: 0|req: 1/2] 192.168.180.0 () {42 vars in 1262 bytes} [Thu Jun 20 08:34:44 2019] GET /qrcode-generator/static/site.css => generated 32 bytes in 20 msecs via sendfile() (HTTP/1.1 200) 8 headers in 303 bytes (0 switches on core 0) [pid: 8|app: 0|req: 2/3] 192.168.180.0 () {40 vars in 1255 bytes} [Thu Jun 20 08:34:49 2019] GET /qrcode-generator/login => generated 567 bytes in 106 msecs (HTTP/1.1 302) 5 headers in 561 bytes (1 switches on core 0) [2019-06-20 08:34:53,764] ERROR in app: OAuth autnetication failed Traceback (most recent call last): File "/data/project/qrcode-generator/www/python/src/app.py", line 98, in oauth_callback app.config['OAUTH_MWURI'], consumer_token, access_token) File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/mwoauth/functions.py", line 252, in identify "A MediaWiki API error occurred: {0}".format(resp['message'])) mwoauth.errors.OAuthException: A MediaWiki API error occurred: The authorization headers in your request are not valid for metawiki [2019-06-20 08:34:53,778] ERROR in app: Exception on /oauth-callback [GET] Traceback (most recent call last): File "/data/project/qrcode-generator/www/python/src/app.py", line 98, in oauth_callback app.config['OAUTH_MWURI'], consumer_token, access_token) File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/mwoauth/functions.py", line 252, in identify "A MediaWiki API error occurred: {0}".format(resp['message'])) mwoauth.errors.OAuthException: A MediaWiki API error occurred: The authorization headers in your request are not valid for metawiki During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/app.py", line 2311, in wsgi_app response = self.full_dispatch_request() File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/app.py", line 1834, in full_dispatch_request rv = self.handle_user_exception(e) File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/app.py", line 1737, in handle_user_exception reraise(exc_type, exc_value, tb) File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/_compat.py", line 36, in reraise raise value File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/app.py", line 1832, in full_dispatch_request rv = self.dispatch_request() File "/data/project/qrcode-generator/www/python/venv/lib/python3.4/site-packages/flask/app.py", line 1818, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/data/project/qrcode-generator/www/python/src/app.py", line 102, in oauth_callback flask.flask(u'OAuth authentication failed.') AttributeError: 'module' object has no attribute 'flask' [pid: 11|app: 0|req: 1/4] 192.168.180.0 () {42 vars in 1801 bytes} [Thu Jun 20 08:34:53 2019] GET /qrcode-generator/oauth-callback?oauth_verifier=a7f5178d9aa812e5a55fe9719cd8b235&oauth_token=3cc8f34b3e2d6d2b1f0968614876ef3c => generated 290 bytes in 218 msecs (HTTP/1.1 500) 2 headers in 84 bytes (1 switches on core 0)