parker
parker

Reputation: 41

Django: Run django app on server without port?

I am running a web application on server. I did all the setups using Django & apache2. When I am running my application with the IP:PORT (x.x.x.x:9000) it works fine.

I tried to run the app with server ip & port, it works fine.

But I just want to run my application on IP only. May be I am wrong because i am newbie to django. If possible can some one give some ideas.

Upvotes: 3

Views: 4307

Answers (3)

lam vu Nguyen
lam vu Nguyen

Reputation: 631

Stop all the services that are running under port 80

as tuomastik told, and maybe someone dont know how to do

How do I kill the process currently using a port on localhost in Windows?

remember to editting

> ALLOWED_HOSTS

in setting.py, as tuomastik told, and open port in firewall in server

> python manage.py runserver 0.0.0.0:80

but this

> For http service the default port is 80, for https service, the
> default port is 443

as Shang Wang told, is the most important (for me)

Upvotes: 0

karthika rayasam
karthika rayasam

Reputation: 31

You can run the Django app without using the port as below.

Stop all the services that are running under port 80. Specify your IP address / your domain name in the settings file under

ALLOWED_HOSTS = ['IPadress/domainname']

Execute the following command

python manage.py runserver 0:80

Now run your application in the web browser as x.x.x.x (IP or domain name)

Upvotes: 3

Shang Wang
Shang Wang

Reputation: 25539

According to the discussion in the comment, sounds like you are confused about why do you need to explicitly specify the port. For http service the default port is 80, for https service, the default port is 443. When you are accessing the domain without the port, the request will by default try to hit either one depend on which method you use. You should on your apache setting specify the port to be 80 for http or 443 https. Hope that helps.

Upvotes: 4

Related Questions