Reference articles
One: Write in front
The Django series of learning notes mainly to study, and did not have to write a product to do the market mentality. So many framework configuration bloggers are based on the principle of simplicity, if you want to find in the pursuit of stable, high-performance Django related content, I am afraid to be disappointed. But I think if you are a novice like me, we should learn together and progress together.
Two: About Python
Since it's a Python web Framework, of course you have to install Python. But the most stable Python is installed by default on Mac, so we don't have to worry about it. If you are a win under the classmate, you can refer to the installation of Python. With the most basic environment, we will begin the next step.
Three: Download Django
Download the latest stable version from here: Django-1.x.y.tar.gz, remember is the latest official version Oh. Where x.y is the version number. ~ Next go to the folder directory where you downloaded the file, execute the following command: (Mac default is/users/xxx/downloads,xxx is your username)
tar xzvf Django-1.x.y.tar.gz |
IV: Installing Django
Installation directory:/system/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/ Django-1.7.2-py3.4.egg/django/bin
/*第三步中解压出来的文件夹*/ cd Django-1.x.y sudo python setup.py install |
V: Test if localhost is successful
In general, the first step in building any site framework locally is to test localhost for successful access.
由于django
-admin
.py这个命令并没有在shell的查找路径当中,我门需要修改.bash_profile文件
Add the following code:
Path= "/system/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/ Django-1.7.2-py3.4.egg/django/bin:${path} "
Export PATH
Then we can test it out:
/*创建一个Django目录,以后我们所有的测试样例都将储存在这里*/ sudo mkdir ~/Document/DJango cd ~/Document/DJango /*创建一个用于测试Localhost的网站样例*/ django -admin .py startproject testLocalHost /*启动网站服务*/ cd testLoacalHost python manage.py runserver |
At this point you will get some service startup information, in your browser input: http://localhost:8000 test it success? With it works you can
Install Django under Mac