Linode Flask Image Does Not Work Out of the Box

Hello,

I am unable to get Flask working on a Linode, so I try to strip it down to the very basics, and it still does not work.

  • Create Linode > MarketPlace > Flask > Create Linode

By default then, which the Linode Flask server set up:

  • in /etc/nginx/sites-enabled there is flask_app which has server { … } listening on port 80
  • in /home there is flask_app_project which is a basic flask app

Where do you go to make the flask_app work? I try IPADDRESS/flask_app or IPADDRESS/flask_app_project or various other attempts. NGINX is running because IPADDRESS shows the default NGINX page.

IPADDRESS/flask_app :
The requested URL was not found on the server


I initially tried a custom flask app, changing the entries in /etc/nginx/sites-enabled to the new flask app name. However when trying to run gunicorn it says the IP address is already in use. I also tried killing each PID of gunicorn. Please note running this app with python3 app.py does work, but thats not a server exposed externally.

I did:
unlink /etc/nginx/sites-enabled/default
&
sudo nginx -s reload

gunicorn -w 3 flask_app:app
gives:
Connection in use: ('127.0.0.1', 8000)

What am I missing? Both for the out of box Linode provide Flask image, which doesn't seem to work, and then with a custom flask app I'd like to get running properly with gunicorn.

thanks

1 Reply

Got it to work. If the Flask image is used from Linode, it really gets stuck on the default flask_app that is give. Removing default as it mentions in the docs does not work

To change it first stop:
sudo supervisorctl stop all

then run supervisorctl
supervisorctl
inside of supervisorctl run avail to see if the new flask site that uploaded is listed
> avail

then delete the default flask_app
> delete flask_app

and then add the the one you've uploaded
> add flask_app

& then it should default to the uploaded site when going to the IP

I received from help from Linode support as well, thanks.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct