Accessing django project in LAN systems

You need to explicitly tell the development server to run on your IP rather than localhost.

Try python manage.py runserver your_ip:port.

Though it'll be accessible if you're running through apache or any other webservers other than the development server.

And to your 1st question, I would advice you to host and use a local apache server rather than using development server. Doing so, you can foresee the issues you'll be facing when moving to production.

And to 2nd, there are plenty of resources available configuring Django with different servers. Hail Google. :)


In your settings.py change ALLOWED_HOSTS to

ALLOWED_HOSTS = ['*']

Run your server by entering the following command

python manage.py runserver 0.0.0.0:8000

In order to access the project from another device enter the IP address of the server followed by the port number, which is 8000 in this example.


If you run

python manage.py runserver 0.0.0.0:8000

your development server will be available on port 8000 to anyone on your LAN and on localhost as well (and it does not depend on your ip address)

Tags:

Python

Django

Lan