2 ms·
Your document root is probably /var/www Your web server will let any visitor read the contents of that folder. If you put your code in there, then other peopl
by rahimnathwani 11y ago
Your document root is probably /var/www
Your web server will let any visitor read the contents of that folder. If you put your code in there, then other people could read your code. When you were using php, this was ok, because your web server knew that it should not let people read your php files, but instead run the file and serve the output of the file.
With python, it's not the same. Your Python application acts as a whole. People aren't calling specific files like http://www.ggg.com/manage.py http://www.ggg.com/manage.py
They request a page from your server. The server knows how to use a wsgi file. The wsgi file runs your code, and tells it what the user requested. Your code returns a response, which the web server sends back to the user.
This code can live in any folder on your server, but if you want to keep people from seeing your code and database credentials, then it should not be in /var/www, but somewhere else. The book suggests your home folder. If you don't know what that means, find a tutorial on basic command line or basic Linux.
Good luck.
- CaiGengYang 11y agoOk, pretty sure I know what the home folder is on the Mac. Basically you click on Finder --> Go --> Home , which takes you to the "home folder". Correct me if I am wrong. As for the next chapter(Database setup), I opened up mysite/settings.py as per the instructions on the manual. However, when I try to run the following command : $ python manage.py migrate to create the tables in the database, I get the following error message --- CaiGengYangs-MacBook-Pro:Weiqi CaiGengYang$ python manage.py migrate ---- input /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'manage.py': [Errno 2] No such file or directory ---- output Any idea how to solve this ?