➜ virtualenv ls test_env ➜ virtualenv source test_env/bin/activate # 如果是windows则是source test_env/Script/activate (test_env)➜ virtualenv python Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import django Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'django' >>> exit() (test_env)➜ virtualenv pip install django Collecting django Using cached Django-1.7.3-py2.py3-none-any.whl Installing collected packages: django Successfully installed django-1.7.3 (test_env)➜ virtualenv python Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import django
import django没有发生错误,证明已经成功安装Django了
开始第一个Django app
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(test_env)➜ virtualenv django-admin startproject mysite (test_env)➜ virtualenv ls mysite test_env (test_env)➜ virtualenv cd mysite
(test_env)➜ mysite python manage.py runserver Performing system checks... System check identified no issues (0 silenced). You have unapplied migrations; your app may not work properly until they are applied. Run 'python manage.py migrate' to apply them. January 24, 2015 - 14:52:09 Django version 1.7.3, using settings 'mysite.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [24/Jan/2015 14:52:17] "GET / HTTP/1.1" 200 1759