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!

  • 相关阅读:
    C语言(北京理工大学MOOC 上)
    四则运算、进制转换、变量内存分配
    C语言(挑战ACM-ICPC,DEVFORGE学编程社区)
    迭代公式求平方根
    C语言(数据结构,DEVFORGE学编程社区)
    C语言(复杂数据,DEVFORGE学编程社区)
    C语言(字符串,DEVFORGE学编程社区)
    c语言(北京理工大学mooc 下)
    华中农业大学mooc编程题
    Java通过POI读取Excel
  • 原文地址:https://www.cnblogs.com/cnapple/p/11881781.html
Copyright © 2011-2022 走看看