Diango安装及创建项目

安装Diango

命令: sudo pip install Django
错误:

root:bin xianglingchuan$ sudo pip install Django
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
The directory '/Users/root/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/root/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Django
  Downloading Django-2.0.tar.gz (8.0MB)
    100% |████████████████████████████████| 8.0MB 25kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-fumLES/Django/setup.py", line 32, in <module>
        version = __import__('django').get_version()
      File "django/__init__.py", line 1, in <module>
        from django.utils.version import get_version
      File "django/utils/version.py", line 61, in <module>
        @functools.lru_cache()
    AttributeError: 'module' object has no attribute 'lru_cache'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-fumLES/Django/
root:bin xianglingchuan$ sudo pip install Django==1.9

因为Django与python存在不兼容,命令修改为:
sudo pip install Django==1.9

创建项目

django-admin.py startproject dmosite

启动项目

python manage.py runserver 0.0.0.0:8002

目录说明:
manage.py: 一个实用的命令行工具,可让你以各种方式与该 Django 项目进行交互。
demosite/init.py: 一个空文件,告诉 Python 该目录是一个 Python 包。
demosite/settings.py: 该 Django 项目的设置/配置。
demosite/urls.py: 该 Django 项目的 URL 声明; 一份由 Django 驱动的网站”目录”。
demosite/wsgi.py: 一个 WSGI 兼容的 Web 服务器的入口,以便运行你的项目。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值