Python Forum
Cannot acess flaskkbb from 'outside'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot acess flaskkbb from 'outside'
#1
Hi - hope this is the right place - first post (long).

I started with flaskbb a year or so ago and could not get it to work from 'outside'. I left it then, but have come back to it. I am hosting on Ubuntu 18.04, flaskbb, nginx and uWSGI.

I have flaskbb working locally on port 5000. I have tested a simple flask app from someone called Nash (referred to here as nash) that displays variables and values supplied in the URL. I can get this to work from 'outside' (from a browser not on my server) quite happily. I simply cannot get flaskbb to work from outside. All I get is 502 Bad Gateway. I have Googled this for some time but am getting nowhere.

In /etc/nginx/sites-enabled I swap between links to /etc/nginx/sites-available/nash and flaskbb2 :-
nash contains
++++
server {
listen 80;
server_name myserver.uk www.myserver.uk;

location / {
include uwsgi_params;
uwsgi_pass unix:/home/.../nash/app.sock;
access_log /var/log/nginx/nash_access.log;
error_log /var/log/nginx/nash_error.log;
}
}
----

This works.

flaskbb2 contains
++++
server {
listen 80;
server_name myserver.uk www.myserver.uk;

location / {
include uwsgi_params;
uwsgi_pass unix:/home/.../flaskbb2/app.sock;
access_log /var/log/nginx/flaskbb_access.log;
error_log /var/log/nginx/flaskbb_error.log warn;
}
}
----


Also when I 'flaskbb run' I get
++++
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
----


Why does this say port 5000, should it not be 80? Even in all the doc for production it shows 5000. Am I missing something? Any help would be appreciated.

Extra bits for nash:-
/etc/systemd/system/nash.service
++++
Description=A simple Flask uWSGI application
After=network.target

[Service]
User=andy
Group=www-data
WorkingDirectory=/home/.../nash
Environment="PATH=/home/.../nash/env/bin"
ExecStart=/home/.../nash/env/bin/uwsgi --ini app.ini

[Install]
WantedBy=multi-user.target
----

app.ini
++++
[uwsgi]
; Production .ini file
module = run:app
master = true

; There is no magic rule for setting the number of processes or threads to use.
; It is very much application and system dependent so you'll need to experiment.
processes = 2
threads = 2

socket = app.sock
chmod-socket = 660
vacuum = true
die-on-term = true
----


And extra for flaskbb2
/etc/systemd/system/flaskbb2.service
++++
[Unit]
Description=A Flask Buletin Board
After=network.target

[Service]
User=andy
Group=www-data
WorkingDirectory=/home/.../flaskbb2
Environment="PATH=/home/.../flaskbb2/env/bin"
ExecStart=/home/.../flaskbb2/env/bin/uwsgi --ini app.ini

[Install]
WantedBy=multi-user.target
----

app.ini
++++
[uwsgi]
; Production .ini file
module = wsgi:flaskbb
master = true

; There is no magic rule for setting the number of processes or threads to use.
; It is very much application and system dependent so you'll need to experiment.
processes = 2
threads = 2

socket = app.sock
chmod-socket = 660
vacuum = true
die-on-term = true
----


Thanks, Andy.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020