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!

  • 相关阅读:
    八、springboot 简单优雅的通过docker-compose 构建
    【并发编程】ThreadLocal其实很简单
    计算机网络
    相似度
    不同激活函数的区别
    快速排序+归并排序
    xgboost
    c++面试
    PCA算法和SVD
    各种排序算法的时间复杂度和空间复杂度
  • 原文地址:https://www.cnblogs.com/cnapple/p/11881781.html
Copyright © 2011-2022 走看看