4 ms·
The Python Paradox
So I am reading Paul Graham's essay "The Python Paradox" and decided to learn Python.
I downloaded Python 3.4.3, pip and django version 1.8.4 and am going through this tutorial : https://docs.djangoproject.com/en/1.8/intro/tutorial01/
I managed to run the command $ python -c "import django; print(django.get_version())" and verify my django version correctly.
The 2nd chapter (Creating a project) gives these instructions :
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.
From the command line, cd into a directory where you’d like to store your code, then run the following command:
$ django-admin startproject mysite
This will create a mysite directory in your current directory. If it didn’t work, see Problems running django-admin.
I ran into some problems here : How do you "cd into a directory where you'd like to run your code" ?
- marssaxman 11y agocd 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.
- deleted 11y ago[deleted]
- CaiGengYang 11y agoOk , 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" ?
- dev1n 11y agoHere 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-prompt.html http://www.cs.princeton.edu/courses/archive/spr05/cos126/cmd...