Wednesday, April 27, 2016

Re: I'm new to programming, I don't know where consider as "document root of web server"


On 28 April 2016 at 14:41, Mie Rex <rexmie888@gmail.com> wrote:
for your case, site1 and site2 are two isolate webserver, correct?
Will all the files under both of these directories open to public once the server is up and running?

Oops - almost, but not quite. Site1 and Site2 are two different websites, being served by the same webserver. A web server can serve as many sites as you want, so long as you configure them all correctly.

"open to the public" is a tricky phrase. In a traditional site (I'm an old man) that would have been the case - long list of .html files and they would be "served". These days it's more common for the files to be mini database-referencing programs (like .php files), or in the case of Django to be a systemic framework that requires one more server (a 'gateway interface', like Gunicorn, wsgi, fastcgi, etc - these normally execute the .py files).

That is a very complex answer - I'm sorry, but web serving is fiddly :/

But the simple answer is yes - if you have configured the server correctly, both directories will be "served".

 
Is the article from the tutorial suggest to have .py files store in some other place to avoid it being see by visitors online?
So the framework could just import scripts from designated place through PYTHONPATH even when the scripts are not placed within site1 or site2?


I can't speak to the exact reason why it is recommended that you avoid putting them in the traditional document root. I would suggest that it's almost certainly due to security reasons. I wont guess what they are, because I can think of half a dozen off the top of my head that are confusing and potentially wrong. But it's almost certainly for server security, yes.



Thank you for such a quick response especially to my extremely novice question.
I hope I would learn a lot from this community, thank you very much


No problems. I learnt a lot here too.

cheers
L.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGBeqiNc2eSDZ_AhKJ-Q0QT1fPwf%2BT%3DpD35n10x_4tXRGArKEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment