zoukankan      html  css  js  c++  java
  • Django First Time

    At first, you should install Django module:

    This may not work:

    pip3 install Django

    You should try the code below:

    sudo python3 -m pip install django -i https://pypi.douban.com/simple

    or

    sudo python3 -m pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple

    setup a project:

    django-admin startproject site .

    don't forget the "." at the end of the line

    cd site
    python3 manage.py runserver

    you will see:

    (venv) nszhou@nszhou-virtual-machine:~/PycharmProjects/blog2$ python3 manage.py runserver
    Watching for file changes with StatReloader
    Performing system checks...
    
    System check identified no issues (0 silenced).
    
    You have 17 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.
    
    November 18, 2019 - 05:53:11
    Django version 2.2.7, using settings 'blog.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.

    then CONTROL-C and type the code below:

    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 sessions.0001_initial... OK

    ok, start chrome, visit http://localhost:8000, congratulations!

  • 相关阅读:
    JAVA最简单常识
    BREW的资源文件概述及问题
    c语言 512
    c语言510 求矩阵的乘积
    c语言 511
    c语言57
    c语言 59
    c语言55 在应用对象式宏的数组中对数组元素进行倒序排列
    c语言 511
    c语言 510 求4行3列矩阵和3行4列矩阵的乘积。各构成元素的值从键盘输入。
  • 原文地址:https://www.cnblogs.com/cnapple/p/11881781.html
Copyright © 2011-2022 走看看