-1

I am getting into Flask/Python model and it seems to be getting along fine in the initial stages. Is there a way to run python application as a web application on a simple desktop computer and use that app over LAN? If yes, what will be the process for that?

I mean, I understand that frameworks like flask/django/bottle run their own server instance which results in the execution of such web apps. In this way they are practically acting as IIS/Apache. Correct?

The reason for this question is that this app will be accessed by only 4-5 individuals & we all are a part of the same team.

davidism
  • 121,510
  • 29
  • 395
  • 339
shammsing
  • 3
  • 2

1 Answers1

0

If the number of users are going to be limited to 4-5, then django server might just be enough for you. You'll just need a router and devices with WiFi access or just an access to the router. You can simply run your server as,

python3 manage.py runserver 0.0.0.0:8000

python or python3, depending on what you're using.

After this your django project would be visible on all the devices connected to your router, at the address,

Local-IP-Address-Of-Device-Runing-Django-Project:8000.

Note: Django is excellent during the development phase but it's not recommended for production use, or when users increase. see docs here So I recommend that if number of users increase(increase in load), ideally you should switch to gunicorn with ngnix or apache server (gunicorn is easy and widely used for python apps. It usually works well ngnix as a reverse proxy; entrance point to your server). There are many tutorials for hosting your website using gunicorn with ngnix as a reverse proxy.
Hope this helps. Thanks.

Shivam Sharma
  • 901
  • 1
  • 6
  • 12
  • Thanks very much, Shivam. It definitely gives me the direction. – shammsing Jul 22 '17 at 16:17
  • Thanks very much, Shivam. It definitely gives me the direction. But I still have some doubts.. sorry it may sound very basic.... 1) I believe, I'll be executing this command "python3 manage.py runserver 0.0.0.0:8000" on the Python shell of the local computer that will be hosting the django/flask server instance. Correct ? 2) What exactly does this 0.0.0.0 IP address signify in this case ? Is it like the default route ? 3) This process to run server instance on a local LAN system & use it within the team will remain the same whether I use Django or Flask. Correct ? – shammsing Jul 22 '17 at 16:27
  • 1) `python3 manage.py runserver 0.0.0.0:8000` is a command that is recognized by the Unix/Linux Terminal. python3 runs the manage.py file. This command will not be recognized in your python shell. 2) Yes 0.0.0.0 signifies the default route. Basically your server running on 0.0.0.0 can be reached(accessed) by all the machines that are connected to it. Example: all the machines connected to your LAN(Router in this case) Network. 3) I've never used flask. But I suppose the basic concept wouldn't change. A similar approach should work with flask as well. – Shivam Sharma Jul 22 '17 at 19:24
  • Thanks Shivam... It definitely helps – shammsing Jul 23 '17 at 14:12