zoukankan      html  css  js  c++  java
  • django相关

    https://blog.csdn.net/xjian32123/article/details/76187066?locationNum=7&fps=1

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

    ************************************************************************************************

    https://www.cnblogs.com/yuanchenqi/articles/6083427.html

    *******************************************************************************************

    后台运行django:https://blog.csdn.net/rnger/article/details/79907884

    nohup python manage.py runserver 0.0.0.0:5008 &

    django报错处理参考:https://www.cnblogs.com/daidechong/p/10044783.html

    https://blog.csdn.net/u011798443/article/details/80881931

    centos7部署django(参考部分)

    https://www.cnblogs.com/feixuelove1009/p/5823135.html

    django

    部署虚拟环境

    https://blog.csdn.net/qq_41777113/article/details/79689785

    (1) django的安装和卸载:

    https://www.cnblogs.com/starof/p/4249635.html

    (2)windows系统的pycharm安装django

    https://www.cnblogs.com/98WDJ/p/10691828.html

    (3)社区版本pycharm的manage.py“Couldn't import Django”报错的问题解决

    https://blog.csdn.net/milkign/article/details/80054430

    (4)django2.0 的初始程序:(第一个网页)

    https://blog.csdn.net/ZhangK9509/article/details/80280432

    (5)社区版pycharm创建django

    https://blog.csdn.net/weixin_30409849/article/details/94796290

    (6)django各个版本:

    https://www.cnblogs.com/0bug/p/8849621.html

    二、快速安装django:

    https://blog.csdn.net/xjian32123/article/details/76187066

    pip3 install django==1.11 -i https://pypi.douban.com/simple

    三、关于pycharm每次新建项目都需要重新安装库

    https://blog.csdn.net/vample/article/details/80446620

     四、Pycharm快捷键

      1、代码选中的条件下,同时按住 Ctrl+/,被选中行被注释,再次按下Ctrl+/,注释被取消

      2、编辑   CTRL D: 未选中时,复制当前行到下一行,选中时复制粘贴选中部分。

    3、控制字体大小写快捷键设置:https://www.cnblogs.com/fyknight/p/6937482.html

    五、apache部署django项目

    https://blog.csdn.net/anderslu/article/details/53868081 

       apache配置修改:   https://blog.csdn.net/sunqian666888/article/details/78561399

     六、老男孩的django(武佩琪)

    https://www.cnblogs.com/wupeiqi/p/5237704.html

    https://www.cnblogs.com/wupeiqi/p/5246483.html

    七、django的默认admin页面   http://127.0.0.1:8000/admin/login/?next=/admin/

    创建超级用户,在终端里面输入  python manage.py  createsuperuser

     八、部署django到服务器系统   http://www.cnblogs.com/2mei/p/9213785.html

    简单粗暴:

    直接在工程目录下执行      C:Userssmc892hPycharmProjectsd19_2>python manage.py runserver 127.0.0.1:8000

    修改服务器运行IP   http://www.mamicode.com/info-detail-1978434.html

    九、django连接mysql数据库系统 : https://www.cnblogs.com/testway/p/7435328.html

    十、python安装Pymysql模块      https://blog.csdn.net/QH_JAVA/article/details/73754121    (django 使用数据库需要安装pymysql模块)

           安装mysqlclient模块           https://blog.csdn.net/litang543091965/article/details/78820341           (django 使用数据库需要安装pymysql模块) 

    十一,连接mysql数据库报错

                1、报错【1050, "Table 'django_content_type' already exists"】    https://blog.csdn.net/gaoxiaoba/article/details/52487677?locationNum=15&fps=1


    数据库相关:

    1、在models.py里面写入:

    from django.db import models

    # Create your models here.

    class UserInfo(models.Model):
    #隐藏还会创建id列,还是主键,自增
    username = models.CharField(max_length=32)
    password = models.CharField(max_length=64)

    2、在setting里面添加应用:

    INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app01',
    ]

    3、在terminal里面运行:

    (d19_2) C:Userssmc892hPycharmProjectsd19_2>python manage.py makemigrations

    (d19_2) C:Userssmc892hPycharmProjectsd19_2>python manage.py migrate

    4、再用 navicat for sqlite就可以查看到对应的表结构。

     5、在应用的views.py里面添加代码(实现数据库的增删改查):

    def orm(request):
    #推荐第一种,第一种方法创建models.UserInfo.objects.create(username='root',password='123')
    # 第一种变种dict = {'username':'eric','password':'888'}
    # models.UserInfo.objects.create(**dict)

    # 第二种方法obj = models.UserInfo(username='alex',password='123')
    # obj.save()

    #查询
    #result = models.UserInfo.objects.all()
    result = models.UserInfo.objects.filter(username='root')
    for row in result:
    print(row.id,row.username,row.password)
    print(result)
    # 删除
    models.UserInfo.objects.filter(id=4).delete()
    models.UserInfo.objects.filter(username="alex").delete()
    ##修改更新
    #models.UserInfo.objects.all().update(password="6669")
    models.UserInfo.objects.filter(id=3).update(password="8888888")

    return HttpResponse('orm')

     @@@@@@@@@@@@@@@@@@@@

    数据库增加或者删除列:

    在modle.py里面添加列:  

               email,  gender = models.CharFiled(max_length=60,null=True)    允许列为空

    再执行 python manage.py makemigrations和 python manage.py migrage

    ........................

  • 相关阅读:
    React在componentDidMount里面发送请求
    React 术语词汇表
    React里受控与非受控组件
    React和Vue等框架什么时候操作DOM
    【LeetCode】79. Word Search
    【LeetCode】91. Decode Ways
    【LeetCode】80. Remove Duplicates from Sorted Array II (2 solutions)
    【LeetCode】1. Two Sum
    【LeetCode】141. Linked List Cycle (2 solutions)
    【LeetCode】120. Triangle (3 solutions)
  • 原文地址:https://www.cnblogs.com/yaok430/p/9377298.html
Copyright © 2011-2022 走看看