zoukankan      html  css  js  c++  java
  • django第一课:基本介绍

    django基本介绍

    1.django项目创建

    • django-admin startproject crm
    (djangovirtualenv) pyvip@VIP:~/django$ django-admin startproject crm
    (djangovirtualenv) pyvip@VIP:~/django$ tree
    .
    ├── crm
    │   ├── crm
    │   │   ├── __init__.py
    │   │   ├── settings.py
    │   │   ├── urls.py
    │   │   └── wsgi.py
    │   └── manage.py
    

    2.django启动服务

    • python manage.py runserver 0.0.0.0:8000
    (djangovirtualenv) pyvip@VIP:~/django$ cd crm
    (djangovirtualenv) pyvip@VIP:~/django/crm$ python manage.py runserver 0.0.0.0:8000
    Performing system checks...
    
    System check identified no issues (0 silenced).
    
    You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
    Run 'python manage.py migrate' to apply them.
    
    February 16, 2019 - 14:05:54
    Django version 2.1.7, using settings 'crm.settings'
    Starting development *server* at http://0.0.0.0:8000/
    Quit the server with CONTROL-C.
    

    此时可以在浏览器上通过127.0.0.1:8000访问了,出现 The install worked successfully! Congratulations! 代表访问成功

    3.创建应用

    • python manage.py startapp teacher
    (djangovirtualenv) pyvip@VIP:~/django/crm$ python manage.py startapp teacher
    (djangovirtualenv) pyvip@VIP:~/django/crm$ tree
    .
    ├── crm
    │   ├── __init__.py
    │   ├── __pycache__
    │   │   ├── __init__.cpython-36.pyc
    │   │   ├── settings.cpython-36.pyc
    │   │   ├── urls.cpython-36.pyc
    │   │   └── wsgi.cpython-36.pyc
    │   ├── settings.py
    │   ├── urls.py
    │   └── wsgi.py
    ├── db.sqlite3
    ├── manage.py
    └── teacher
        ├── admin.py
        ├── apps.py
        ├── __init__.py
        ├── migrations
        │   └── __init__.py
        ├── models.py
        ├── tests.py
        └── views.py
    
  • 相关阅读:
    ci框架——文章查看之上篇下篇
    ci框架——分页
    ci框架——数据库(增删改查)
    全选和反选
    基于CI框架的管理系统
    在dedecms系统下, 改写火车头的入库接口 写一个接口文件运行一次自动读取 http://news.163.com/rank/
    缩略图
    php——两种无限级分类
    webpack和webpack-dev-server安装配置(遇到各种问题的解决方法)
    python装饰器
  • 原文地址:https://www.cnblogs.com/donghao1121/p/10398025.html
Copyright © 2011-2022 走看看