Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I setup my Django server on LAN

I have made a Django employee portal which will be accessed by LAN only. It works when another employee opens it by typing the IP address of the server on their web browser. However I don't have much experience with Django and I think that this is not the proper way to do so. I run my server using python manage.py runserver and use sqlite3 as database.

Is this the correct way to do so? How should I deploy my portal. I am very new to Django and would appreciate some help.

I am using a windows machine and I used pycharm to make my project.

And also I need to know how can I have the server running even when I close pycharm, as ctrl-C or closing pycharm breaks the server

like image 607
Rushikesh Mokashi Avatar asked Oct 18 '25 20:10

Rushikesh Mokashi


1 Answers

The simplest way to allow everyone on your network to access your Django webserver is to do python manage.py runserver 0.0.0.0:8000
This allows anyone on the network to access it by using your IP address (or computer name) and the port 8000. (so something like 192.168.1.2:8000)

This of course isn't really nice specially if you intent to use this as a production environment. panchicore's answer should help you setup a good production environment.

like image 61
Resley Rodrigues Avatar answered Oct 21 '25 10:10

Resley Rodrigues