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!

  • 相关阅读:
    人民币对美元汇率的大数据分析与预测【完整代码】
    碧瑶答疑网——用户使用手册和反馈
    碧瑶答疑网—系统设计和任务分配
    碧瑶答疑网之选题报告
    碧瑶答疑网-软件需求规格说明书
    UEgCWbGGLA
    https://www.cnblogs.com/ggzjf/
    66666
    继承-代码块-接口
    人民币对澳元汇率的大数据分析与预测
  • 原文地址:https://www.cnblogs.com/cnapple/p/11881781.html
Copyright © 2011-2022 走看看