I'm a beginner in all these http and tcp/ip thing. So there maybe many things in these questions that may not make sense or are totally incorrect.
First I will add all the questions I had in mind since, I could not put them on title.
I work on django (python framework) for web development.
I'm confused as to how servers work. And how is the destination port is decided through the url?
MAIN Q : What I have learned so far is that through DNS we get the ip address of the website. And port (Both destination and source) are decided by the TCP. And sent through TCP headers. But how does it decide which port should it go to in a server(i.e. destination port).
MY ANS TO ABOVE QUESTION : After spending lots of my time, I have come to know that, http requests default to 80 and https defaults to 443 and similarly other types of requests also defaults to some port. So we can figure out the ip address based on this.
But this rises another question in my mind.
Another Question : I have also built a simple django website and deployed it on pythonanywhere. But I deployed it as a whole application. Suppose my django application accepts different types of requests like HTTP, HTTPS, SMTP, etc. Then how will the port for these specific tasks be decided? Because all these requests will come under single application, so they should run on the same port. I don't think the server will change anything in the application itself. So how will the destination port now be decided?
NOTE : I'm not sure if it is possible to make an application in django which accepts different types of requests. But it should be possible because we can create different app - with startapp and run on different url.
Where ever I read, it said that the default port for http is 80, then that means it should also be possible to change it?
MOST IMPORTANT QUES AND TO SUMMARIZE ALL DOUBTS Suppose I have a project which accepts different requests. And I want to deploy it on server then how will http requests and smtp requests are separated? Do I have to manually make different apps and then deploy on different ports or something? If not and everything runs on same port, then how is this port decided in the browser? Suppose my domain name is xyz.com then how will the specific port be accessed on the server?
Basically how is a destination port decided?