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
    
  • 相关阅读:
    vmware 网络连接
    【剑指offer】设置在最小数目的阵列
    动画语音输入和文字输入开关
    Qt 如何处理拖放应用程序参数时,中国
    C#
    dojo的TabContainer添加ContentPane假设closable,怎么不闭幕后予以销毁ContentPane
    剑指XX(游戏10)
    PHP的MySQL扩张:MySQL数据库概述
    所谓策略,我站在旁边看今天 神刻的样子O2O
    两个新事物
  • 原文地址:https://www.cnblogs.com/donghao1121/p/10398025.html
Copyright © 2011-2022 走看看