随笔分类 -  django

摘要:contenttypes组件的内部帮我们讲django的ORM中定义的所有表都自动手机起来,并保存至 后续开发中如果遇到 一张表 与 其他n张表进行关联,就可以基于contenttypes实现。 表定义 from django.db import models from django.contrib 阅读全文
posted @ 2023-03-12 10:41 Sherwin_szw 阅读(16) 评论(0) 推荐(0) 编辑
摘要:自定义信号 定义信号 import django.dispatch # 自定义信号 cut_info_signal = django.dispatch.Signal() 注册回调 from utils.signals import cut_info_signal def callback_1(sen 阅读全文
posted @ 2023-03-05 11:42 Sherwin_szw 阅读(18) 评论(0) 推荐(0) 编辑
摘要:Logging日志 什么时候用到日志? 可预知的情况,写日志 不可预知情况,写日志 基础版 CRITICAL = 50 FATAL = CRITICAL ERROR = 40 WARNING = 30 WARN = WARNING INFO = 20 DEBUG = 10 NOTSET = 0 im 阅读全文
posted @ 2023-03-04 19:10 Sherwin_szw 阅读(28) 评论(0) 推荐(0) 编辑
摘要:reboot.sh #!/usr/bin/env bash echo -e "\033[34m wsgi process \033[0m" ps -ef|grep uwsgi_order_trading_platform.ini | grep -v grep sleep 0.5 echo -e '\ 阅读全文
posted @ 2022-09-27 19:10 Sherwin_szw 阅读(134) 评论(0) 推荐(0) 编辑
摘要:nginx.conf内 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/n 阅读全文
posted @ 2022-09-27 17:00 Sherwin_szw 阅读(73) 评论(0) 推荐(0) 编辑
摘要:进入虚拟环境 source activate 安装uwsgi pip install uwsgi 命令运行 uwsgi --http :80 --chdir /usr/local/projects/order_trading_platform/ --wsgi-file order_trading_p 阅读全文
posted @ 2022-09-27 14:19 Sherwin_szw 阅读(54) 评论(0) 推荐(0) 编辑
摘要:local_settings.py import os from pathlib import Path DEBUG = False ALLOWED_HOSTS = ['*'] BASE_BASE_DIR = Path(__file__).resolve().parent.parent.parent 阅读全文
posted @ 2022-09-25 19:38 Sherwin_szw 阅读(98) 评论(0) 推荐(0) 编辑
摘要:settings内 。。。 try: from .local_settings import * except Exception as e: print(e) local_settings内 写本地/线上配置 。。。 阅读全文
posted @ 2022-09-25 09:51 Sherwin_szw 阅读(21) 评论(0) 推荐(0) 编辑
摘要:# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ 阅读全文
posted @ 2022-09-25 09:45 Sherwin_szw 阅读(645) 评论(0) 推荐(0) 编辑
摘要:前端html {% if sg.get_row_list %} <div class="panel panel-default "> <div class="panel-heading"> <i class="fa fa-filter" aria-hidden="true"></i> 快速筛选 </ 阅读全文
posted @ 2022-09-24 14:24 Sherwin_szw 阅读(33) 评论(0) 推荐(0) 编辑
摘要:settings INSTALLED_APPS = [ 'django.contrib.messages', # 第一个位置 ] MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', # 第二个位置 ] TEMP 阅读全文
posted @ 2022-09-23 10:05 Sherwin_szw 阅读(38) 评论(0) 推荐(0) 编辑
摘要:前端 {% extends 'layout.html' %} {% load static %} {% block content %} <div class="panel panel-default"> <!-- Default panel contents --> <div class="pan 阅读全文
posted @ 2022-09-19 17:10 Sherwin_szw 阅读(28) 评论(0) 推荐(0) 编辑
摘要:django 后端逻辑 def transaction_add(request, pk): res_code = ResCode() if request.method == 'POST': form = TransactionForm(data=request.POST) if not form. 阅读全文
posted @ 2022-09-17 18:27 Sherwin_szw 阅读(36) 评论(0) 推荐(0) 编辑
摘要:前端js <script> $(function () { $("#addBtn").click(function () { $("#addModal").modal('show') }) $("#submitBtn").click(function () { $.ajax({ url: "{% u 阅读全文
posted @ 2022-09-17 12:53 Sherwin_szw 阅读(28) 评论(0) 推荐(0) 编辑
摘要:model class TransactionRecord(ActiveBaseModel): status_class_mapping = { 1: 'info', 2: 'danger', 3: 'success', 4: 'primary', 5: 'warning', } choice_st 阅读全文
posted @ 2022-09-16 15:01 Sherwin_szw 阅读(57) 评论(0) 推荐(0) 编辑
摘要:前端按钮 {% edit_btn request 'user_edit' pk=user.id %} 后端逻辑 @register.simple_tag def edit_btn(request, url_name, *args, **kwargs): if not check_per(reques 阅读全文
posted @ 2022-09-15 20:02 Sherwin_szw 阅读(31) 评论(0) 推荐(0) 编辑
摘要:前端 {% load btnPermission %} {% add_btn request 'level_add' %} {% edit_btn request 'level_edit' pk=user_level.id %} {% delete_btn request 'level_delete 阅读全文
posted @ 2022-09-15 08:22 Sherwin_szw 阅读(34) 评论(0) 推荐(0) 编辑
摘要:模态框部分 <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-s 阅读全文
posted @ 2022-09-14 07:43 Sherwin_szw 阅读(38) 评论(0) 推荐(0) 编辑
摘要:添加按钮 <div class="pull-left"><a href="{% url 'price_policy_add' %}" class="btn-success btn" style="margin-bottom: 10px"><i class="fa fa-plus-square-o"> 阅读全文
posted @ 2022-09-13 20:59 Sherwin_szw 阅读(27) 评论(0) 推荐(0) 编辑
摘要:前端 <table class="table table-hover table-bordered"> <tr> <th>序号</th> <th>数量</th> <th>价格</th> </tr> {% for one in queryset %} <tr user-id="{{ one.id }} 阅读全文
posted @ 2022-09-13 20:39 Sherwin_szw 阅读(40) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.