“Django基础”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
(未显示同一用户的1个中间版本)
第36行: 第36行:
  
 
=tutorial=
 
=tutorial=
 +
<pre>
 
  $ python3 -m pip install Django==2.2
 
  $ python3 -m pip install Django==2.2
 
  python -m django --version
 
  python -m django --version
 +
 +
 +
 +
    编辑 models.py 文件,改变模型。
 +
    运行 python manage.py makemigrations 为模型的改变生成迁移文件。
 +
    运行 python manage.py migrate 来应用数据库迁移。
 +
 +
</pre>
 +
 +
==tutorial2===
 +
https://docs.djangoproject.com/zh-hans/2.2/intro/tutorial03/
 +
devops/django/djtmp/
  
 
[https://www.runoob.com/django/django-tutorial.html Django 教程]
 
[https://www.runoob.com/django/django-tutorial.html Django 教程]

2021年12月3日 (五) 12:31的版本

进阶

老齐的东西

老齐教室-机器学习数学基础

当前标签:Django开发

python+Django+mysql+bootstrap(前端,数据库一次搞定)从头教你毕设实现一个简易好看的仓储物资管理之类系统

Web开发:常用框架 常用的WSGI服务器

https://www.cnblogs.com/bad-robot/category/1271241.html

Python虚拟环境virtualenv

新建django project的基本步骤 站内知识

How to use Django with Gunicorn


前端Vue结合后端DjangoFramework的在线生鲜超市(前后端分离)

用python获取股票数据、通过django用web展示_通过django搭建一个简易的web页面(实现数据的查询、添加、修改、删除)

django + vue前后端分离

Django个人博客搭建教程---用Vue写你的第一个前后端分离页面

Django Vue.js搭建前后端分离项目超详细过程

django源码

求大神指教,如何学习Django源码?

Django源码分析(四):请求来了

tutorial

 $ python3 -m pip install Django==2.2
 python -m django --version



    编辑 models.py 文件,改变模型。
    运行 python manage.py makemigrations 为模型的改变生成迁移文件。
    运行 python manage.py migrate 来应用数据库迁移。

tutorial2=

https://docs.djangoproject.com/zh-hans/2.2/intro/tutorial03/

devops/django/djtmp/

Django 教程

install

Ubuntu部署Django项目方法详解 ng uswi

django项目中settings.py中的BASE_DIR的分析

1.__file__得到当前文件文件名字

2.os.path.abspath(file)得到当前文件的绝对路径

3.os.path.dirname(os.path.abspath(file))得到当前文件的上一层的文件夹路径

4.os.path.dirname(os.path.dirname(os.path.abspath(file)))得到当前文件的上一次文件夹的上一层文件夹路径

grep -rn  BASE settings.py #当前文件的上一个目录是也 
'DIRS': [os.path.join(BASE_DIR, 'templates'),],


关于django项目中settings.py中的BASE_DIR的分析


关于django:BASE DIR的绝对路径是什么?

django RESTful api

Django model

依赖包到requirements.txt

项目搬迁,快捷导出环境依赖包到requirements.txt

项目搬迁的时候,需要把当前的环境依赖包导出,然后到部署项目的服务器上安装依赖。 我们可以通过下面的命令执行,把依赖包导出到requirements.txt文件里。 生成requirements.txt

pip freeze > requirements.txt

安装requirements.txt依赖

pip install -r requirements.txt

Django结合Pyecharts实现数据可视化

数据可视化图形展示pyecharts 大部分在这里啦

https://blog.csdn.net/qq_34156628/article/details/106308176

我的代码 在 https://github.com/evan886/pyecharts-learn

celery

Celery是由Python开发、简单、灵活、可靠的分布式任务队列,其本质是生产者消费者模型,生产者发送任务到消息队列,消费者负责处理任务
Celery由以下四部分构成:任务模块(Task)、消息中间件(Broker)、任务执行单元Worker、结果存储(Backend) 
  任务模块Task:包含异步任务和定时任务,异步任务通常在业务逻辑中被触发并发往任务队列,而定时任务由Celery Beat进程周期性的将任务发往任务队列
  消息中间件Broker:即为任务调度队列,接收任务生产者发来的消息(即任务),将任务存入队列。Celery本身不提供队列服务,官方提供了很多备选方案,支持RabbitMQ、Redis、Amazon SQS等,官方推荐RabbitMQ。
  任务执行单元Worker:Worker是任务执行单元,负责从消息队列中取出任务执行,它可以启动一个或者多个,也可以启动在不同的机器节点,这就是其实现分布式的核心。实时监控消息队列,获取队列中调度的任务并执行它。
  结果存储Backend:用于存储任务的执行结果。官方提供了诸多的存储方式支持:RabbitMQ、 Redis、Memcached、SQLAlchemy、Django ORM、Apache Cassandra、Elasticsearch
Django中使用定时任务

  如果想要在django中使用定时任务功能同样是靠beat完成任务发送功能,当在Django中使用定时任务时,需要安装django-celery-beat插件。以下将介绍使用过程。


learn

learn  Django中使用Celery 讲的一样有 refu api 

【good】【异步/定时任务】Django中使用Celery实现异步和定时任务 转Django+Django-Celery+Celery的整合实战

异步任务队列Celery在Django中的使用

https://docs.celeryproject.org/en/v4.3.0/getting-started/next-steps.html#using-celery-in-your-application

分布式任务队列Celery入门与进阶

Django中使用Celery

Django中使用Celery实现定时任务(用djcelery)

celery集合django使用


celery任务状态监控


异步服务Celery生产者消费者模式redis为数据库支撑

3-django进阶之celery

flower

pip install flower 
Usage Examples

Launch the Flower server at specified port other than default 5555 (open the UI at http://localhost:5566):

 $ celery flower --port=5566

https://flower.readthedocs.io/en/latest/install.html


相关的任务队列

Django-Q django Q 的使用方法

提高django的并发能力

如何提高django的并发能力

常用知识

Json序列化和反序列化模块dumps、dump、loads、load功能

Json的序列化和反序列化:

序列化: 将Python对象转换为Json字符串 - - - > dumps和dump 反序列化: 将Json字符串转换为Python对象 - - - > loads和load

运维开发笔记整理-序列化

Json序列化和反序列化模块dumps、dump、loads、load功能介绍

Django HttpResponse与JsonResponse

Django HttpResponse与JsonResponse

Django的objects.get和objects.filter方法详解

Django的objects.get和objects.filter方法详解和区别

Django--makemigrations和migrate的差别

浅谈Django--makemigrations和migrate的差别

2021 cmdb django learn

Python---Django项目实战:CMDB资产扫描和DevOPS自动化运维

trouble shouoting

UserIPInfo is not defined
NameError: name 'BrowseInfo' is not defined

from scanhosts.models import  UserIPInfo


django.db.utils.DataError: (1406, "Data too long for column 'user_agent' at row 1")

mysql >SET @@global.sql_mode= '';
或者创建库时为 大utf8

    user_agent = models.CharField(max_length=100, default='',verbose_name='用户浏览器信息', null=True)


views.py
搭建 python Django 框架时报错: 'HttpResponse' is not defined

这里要导入:

from django.shortcuts import HttpResponse

name 'JsonResponse' is not defined

from django.http import HttpResponse,JsonResponse

mysql报错:1406, "Data too long for column

站内资源

Cmdb

see also

学Python Django学得很迷茫,怎么办?


Django开发 运维开发笔记整理-使用Django编写helloworld 

运维开发笔记整理-创建django用户