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!

  • 相关阅读:
    获取dbf中的表名
    dbf 工程模式连接(vfp c# )
    SQL Server插入中文数据出现乱码问题
    给老婆写的带返回的2048(数据库存储)
    BundleConfig包含js,css失败
    (wp8.1开发)添加数据(SQLite)库到app
    (wp8.1开发)触摸键从推出变返回
    java基础-jdk工具包
    java基础-开发工具IDEA
    java高级-动态注入替换类Instrumentation
  • 原文地址:https://www.cnblogs.com/cnapple/p/11881781.html
Copyright © 2011-2022 走看看