Score:0

How to set up a wireless LAN to serve Flask?

ru flag

I got a Flask Server I run in localhost and I want for devices to access it without the need for internet. I read that it may be possible by setting up a LAN network and I wonder if its possible to create one with Ubuntu and use it for devices to connect to that network wirelessly and access the services provided by my Flask application.

  • Do I need a router to achieve this?
  • How can I configure my Ubuntu 21 machine to be accessed by other devices such as Android or Raspberry without the need for an internet connection?

I've been looking for ways to do it and all I see are tutorials that assume one has an internet connection.

David avatar
cn flag
There is no such version as Ubuntu 21.
Score:0
th flag

What you actually need is a Wireless Access Point (AP), often built-in in wireless internet routers. You may turn your machine into an AP by using the WiFi-HotSpot-Feature from Ubuntu (more Details), so you dont need an extra hardware.

That way your clients should be able to connect wirelessly to your machine and then, all devices are in (W)LAN. You need to specify the same subnetmask on all clients and every client needs a unique IP-Adress from the same subnet, for example:

  • IP: 192.168.1.x (replace x by any number between 1 and 254)
  • Subnetmask: 255.255.255.0

Finally you need to setup your Flask-Server to listen on your machines IP-Address instead of localhost or 127.0.0.1. I don't know Flask, maybee use the --host flag ?

If you use the flask executable to start your server, use flask run --host=0.0.0.0 to change the default from 127.0.0.1 and open it up to non-local connections. (more Details)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.