
The Python Paradox - CaiGengYang
So I am reading Paul Graham&#x27;s essay &quot;The Python Paradox&quot; and decided to learn Python.<p>I downloaded Python 3.4.3, pip and django version 1.8.4 and am going through this tutorial : https:&#x2F;&#x2F;docs.djangoproject.com&#x2F;en&#x2F;1.8&#x2F;intro&#x2F;tutorial01&#x2F;<p>I managed to run the command $ python -c &quot;import django; print(django.get_version())&quot; and verify my django version correctly.<p>The 2nd chapter (Creating a project) gives these instructions :<p>If this is your first time using Django, you’ll have to take care of some initial setup. Namely, you’ll need to auto-generate some code that establishes a Django project – a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.<p>From the command line, cd into a directory where you’d like to store your code, then run the following command:<p>$ django-admin startproject mysite
This will create a mysite directory in your current directory. If it didn’t work, see Problems running django-admin.<p>I ran into some problems here : How do you &quot;cd into a directory where you&#x27;d like to run your code&quot; ?
======
dev1n
Here is a good resource to check out to learn more about the command line [1].

[1]:[http://www.cs.princeton.edu/courses/archive/spr05/cos126/cmd...](http://www.cs.princeton.edu/courses/archive/spr05/cos126/cmd-
prompt.html)

------
marssaxman
cd is a command. It takes an argument, which is a path to a folder. It could
be any folder; it's up to you.

If you decide to make a folder in your home directory which is named "floop",
you would type this command:

$ cd floop

Now your shell is inside the floop folder, and everything you do until the
next 'cd' command will happen relative to the contents of the floop folder.

~~~
CaiGengYang
Ok , so I created a folder called "Weiqi" in my home directory. (named after
the game I am best at!)

Then I typed the command $ cd Weiqi in the "Terminal"

CaiGengYangs-MacBook-Pro:~ CaiGengYang$ cd Weiqi --- input

and got this output :

CaiGengYangs-MacBook-Pro:Weiqi CaiGengYang$ --- output

Then I ran the following command in the Terminal : $ django-admin startproject
mysite.

This created a mysite folder which appeared inside the original Weiqi folder
in my home directory.

When I clicked on the mysite folder, there is a manage.py file and another
mysite folder inside the original mysite folder.

When I click on the mysite folder, there are 4 files in it : __init__.py ,
settings.py , urls.py and wsgi.py.

The next chapter of the tutorial says this :

"Where should this code live?

If your background is in plain old PHP (with no use of modern frameworks),
you’re probably used to putting code under the Web server’s document root (in
a place such as /var/www). With Django, you don’t do that. It’s not a good
idea to put any of this Python code within your Web server’s document root,
because it risks the possibility that people may be able to view your code
over the Web. That’s not good for security.

Put your code in some directory outside of the document root, such as
/home/mycode."

I am a little confused about the last paragraph : What exactly is a "directory
outside of the document root, such as /home/mycode." and how do you "Put your
code in this directory" ?

