zoukankan      html  css  js  c++  java
  • python django初始化

    C:\Users\Administrator>pip install virtualenv
    Collecting virtualenv
      Downloading virtualenv-20.10.0-py2.py3-none-any.whl (5.6 MB)
         |████████████████████████████████| 5.6 MB 39 kB/s
    Collecting filelock<4,>=3.2
      Downloading filelock-3.4.0-py3-none-any.whl (9.8 kB)
    Collecting backports.entry-points-selectable>=1.0.4
      Downloading backports.entry_points_selectable-1.1.1-py2.py3-none-any.whl (6.2 kB)
    Collecting distlib<1,>=0.3.1
      Downloading distlib-0.3.4-py2.py3-none-any.whl (461 kB)
         |████████████████████████████████| 461 kB 20 kB/s
    Requirement already satisfied: six<2,>=1.9.0 in d:\python\python310\lib\site-packages (from virtualenv) (1.16.0)
    Collecting platformdirs<3,>=2
      Downloading platformdirs-2.4.0-py3-none-any.whl (14 kB)
    Installing collected packages: platformdirs, filelock, distlib, backports.entry-points-selectable, virtualenv
    Successfully installed backports.entry-points-selectable-1.1.1 distlib-0.3.4 filelock-3.4.0 platformdirs-2.4.0 virtualenv-20.10.0

    C:\Users\Administrator>pip list
    Package                           Version
    --------------------------------- ---------
    asgiref                           3.4.1
    async-generator                   1.10
    attrs                             21.2.0
    backports.entry-points-selectable 1.1.1
    certifi                           2021.10.8
    cffi                              1.15.0
    cryptography                      36.0.1
    distlib                           0.3.4
    Django                            4.0
    filelock                          3.4.0
    h11                               0.12.0
    idna                              3.3
    outcome                           1.1.0
    pip                               21.3.1
    platformdirs                      2.4.0
    pycparser                         2.21
    pygame                            2.1.1
    pyOpenSSL                         21.0.0
    selenium                          4.1.0
    setuptools                        58.1.0
    six                               1.16.0
    sniffio                           1.2.0
    sortedcontainers                  2.4.0
    sqlparse                          0.4.2
    trio                              0.19.0
    trio-websocket                    0.9.2
    tzdata                            2021.5
    urllib3                           1.26.7
    virtualenv                        20.10.0
    wsproto                           1.0.0

    C:\Users\Administrator>django-admin start-project my-site
    No Django settings specified.
    Unknown command: 'start-project'. Did you mean startproject?
    Type 'django-admin help' for usage.

    C:\Users\Administrator>d:

    D:\>cd python

    D:\Python>cd python310

    D:\Python\Python310>dir
     驱动器 D 中的卷没有标签。
     卷的序列号是 F0C3-73A9

     D:\Python\Python310 的目录

    2021/12/25  20:46    <DIR>          .
    2021/12/25  20:46    <DIR>          ..
    2021/12/25  20:20    <DIR>          DLLs
    2021/12/25  20:20    <DIR>          Doc
    2021/12/25  21:06    <DIR>          include
    2021/12/25  20:20    <DIR>          Lib
    2021/12/25  20:20    <DIR>          libs
    2021/12/06  19:28            32,762 LICENSE.txt
    2021/12/06  19:29         1,225,432 NEWS.txt
    2021/12/06  19:28            98,544 python.exe
    2021/12/06  19:28            61,680 python3.dll
    2021/12/06  19:28         4,471,024 python310.dll
    2021/12/06  19:28            97,008 pythonw.exe
    2021/12/26  19:31    <DIR>          Scripts
    2021/12/25  20:20    <DIR>          tcl
    2021/12/25  20:20    <DIR>          Tools
    2021/12/06  19:29            97,168 vcruntime140.dll
    2021/12/06  19:29            37,240 vcruntime140_1.dll
                   8 个文件      6,120,858 字节
                  10 个目录 13,259,005,952 可用字节

    D:\Python\Python310>
    D:\Python\Python310>
    D:\Python\Python310>
    D:\Python\Python310>
    D:\Python\Python310>
    D:\Python\Python310>
    D:\Python\Python310>django-admin start-project my-site
    No Django settings specified.
    Unknown command: 'start-project'. Did you mean startproject?
    Type 'django-admin help' for usage.

    D:\Python\Python310>django-admin startproject my-site
    CommandError: 'my-site' is not a valid project name. Please make sure the name is a valid identifier.

    D:\Python\Python310>django-admin startproject mysite

    D:\Python\Python310>dir
     驱动器 D 中的卷没有标签。
     卷的序列号是 F0C3-73A9

     D:\Python\Python310 的目录

    2021/12/26  19:57    <DIR>          .
    2021/12/26  19:57    <DIR>          ..
    2021/12/25  20:20    <DIR>          DLLs
    2021/12/25  20:20    <DIR>          Doc
    2021/12/25  21:06    <DIR>          include
    2021/12/25  20:20    <DIR>          Lib
    2021/12/25  20:20    <DIR>          libs
    2021/12/06  19:28            32,762 LICENSE.txt
    2021/12/26  19:57    <DIR>          mysite
    2021/12/06  19:29         1,225,432 NEWS.txt
    2021/12/06  19:28            98,544 python.exe
    2021/12/06  19:28            61,680 python3.dll
    2021/12/06  19:28         4,471,024 python310.dll
    2021/12/06  19:28            97,008 pythonw.exe
    2021/12/26  19:31    <DIR>          Scripts
    2021/12/25  20:20    <DIR>          tcl
    2021/12/25  20:20    <DIR>          Tools
    2021/12/06  19:29            97,168 vcruntime140.dll
    2021/12/06  19:29            37,240 vcruntime140_1.dll
                   8 个文件      6,120,858 字节
                  11 个目录 13,258,997,760 可用字节

    D:\Python\Python310>cd mysite

    D:\Python\Python310\mysite>dir
     驱动器 D 中的卷没有标签。
     卷的序列号是 F0C3-73A9

     D:\Python\Python310\mysite 的目录

    2021/12/26  19:57    <DIR>          .
    2021/12/26  19:57    <DIR>          ..
    2021/12/26  19:57               684 manage.py
    2021/12/26  19:57    <DIR>          mysite
                   1 个文件            684 字节
                   3 个目录 13,258,997,760 可用字节

    D:\Python\Python310\mysite>python3 manage.py runserver 0.0.0.0:8000

    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>python3 manage.py runserver 0.0.0.0:8000

    D:\Python\Python310\mysite>python manage.py runserver 0.0.0.0:8000
    Watching for file changes with StatReloader
    Performing system checks...

    System check identified no issues (0 silenced).

    You have 18 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.
    December 26, 2021 - 20:00:05
    Django version 4.0, using settings 'mysite.settings'
    Starting development server at http://0.0.0.0:8000/
    Quit the server with CTRL-BREAK.
    [26/Dec/2021 20:00:48] "GET / HTTP/1.1" 200 10697
    [26/Dec/2021 20:00:49] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
    [26/Dec/2021 20:00:49] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
    [26/Dec/2021 20:00:49] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
    [26/Dec/2021 20:00:49] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
    Not Found: /favicon.ico
    [26/Dec/2021 20:00:49] "GET /favicon.ico HTTP/1.1" 404 2110

    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>
    D:\Python\Python310\mysite>python manage.py migrate
    Operations to perform:
      Apply all migrations: admin, auth, contenttypes, sessions
    Running migrations:
      Applying contenttypes.0001_initial... OK
      Applying auth.0001_initial... OK
      Applying admin.0001_initial... OK
      Applying admin.0002_logentry_remove_auto_add... OK
      Applying admin.0003_logentry_add_action_flag_choices... OK
      Applying contenttypes.0002_remove_content_type_name... OK
      Applying auth.0002_alter_permission_name_max_length... OK
      Applying auth.0003_alter_user_email_max_length... OK
      Applying auth.0004_alter_user_username_opts... OK
      Applying auth.0005_alter_user_last_login_null... OK
      Applying auth.0006_require_contenttypes_0002... OK
      Applying auth.0007_alter_validators_add_error_messages... OK
      Applying auth.0008_alter_user_username_max_length... OK
      Applying auth.0009_alter_user_last_name_max_length... OK
      Applying auth.0010_alter_group_name_max_length... OK
      Applying auth.0011_update_proxy_permissions... OK
      Applying auth.0012_alter_user_first_name_max_length... OK
      Applying sessions.0001_initial... OK

    D:\Python\Python310\mysite>python manage.py runserver 0.0.0.0:8000
    Watching for file changes with StatReloader
    Performing system checks...

    System check identified no issues (0 silenced).
    December 26, 2021 - 20:02:26
    Django version 4.0, using settings 'mysite.settings'
    Starting development server at http://0.0.0.0:8000/
    Quit the server with CTRL-BREAK.
    [26/Dec/2021 20:02:33] "GET / HTTP/1.1" 200 10697
    Not Found: /favicon.ico
    [26/Dec/2021 20:02:33,586] - Broken pipe from ('127.0.0.1', 5639)
    -----------------------------------建管理用户---------------------------------------
    D:\Python\Python310\mysite>python manage.py createsuperuser
    Username (leave blank to use 'shenggong'): admin
    Email address: sheng-gong.luan@163.com
    Password:
    Password (again):
    Superuser created successfully.

  • 相关阅读:
    Jquery 判断值是否存在于数组之内
    Linux 拷贝有更改的文件
    Thinkphp [美味]常用代码
    Oracle基础知识:DECODE、NVL
    安装配置svn
    搭建LAMP环境以及shell脚本搭建(yum安装)
    Jmeter接口测试webservice
    Jmeter插件安装和使用
    Jmeter中java接口测试
    Jmeter中聚合报告吞吐量的计算
  • 原文地址:https://www.cnblogs.com/shenggong/p/15733858.html
Copyright © 2011-2022 走看看