Launch Django without Apache using the launch server on port 80 and an accessible external LAN

In debug mode, I can launch the django website, which can be accessed publicly (inside the local network):

python manage.py runserver 0.0.0.0:8000 

So, is it possible to run it directly on port 80 (possibly with a domain), as a regular web server does? If so, is that a bad idea? I mean, is it better to use apache with mod_wsgi ?

+6
source share
4 answers

Perhaps, but this is a very bad idea, because the default server that django ships with does not support multiprocessing, etc., and is intended solely for development.

As documentation notes :

Good time to take notes: DONT uses this server in everything that resembles a production environment. Its intended use is for development use only. (Were in the development of web frameworks, not web servers.)

Regarding choosing a web server, check out the django book for more ideas on how to do this.

+4
source

It is possible. You can do it as follows:

 python manage.py runserver yourdomain.com:80 

Whether this is a bad idea may depend on your use case. I usually recommend using, for example, apache or nginx for a long-term working environment. This will certainly work better.

+3
source

Sounds like two questions.

  • Is it possible? Yes (see @geckon answer).
  • Is it wise to work with a lightweight debug development server in production ?: No

But, fortunately, there is a lot of official documentation on running Apache with mod_wsgi , so it shouldn't be too complicated.

+1
source

If you need to more easily debug the problem, especially when using a similar deployment environment, but still run it on port 80, then assuming that the Apache system is disabled and therefore does not use port 80 at the time, look at mod_wsgi-express.

For information on better mod_wsgi-express integration with Django and its use for debugging, see

+1
source

Source: https://habr.com/ru/post/988589/


All Articles