博客

  • deepin v20 & uos 20 无法运行electron应用(appimage)解决方法

    打开终端 运行你不能启动的程序:

    master@Origin:~$ electron-ssr
    [5388:0415/233033.798417:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I’m aborting now. You need to make sure that /opt/electron-ssr/chrome-sandbox is owned by root and has mode 4755.

    给它设置权限(具体路径按错误提示里面,部分随机命名到/tmp路径下的应用暂时无解):

    sudo chmod 4755 /opt/electron-ssr/chrome-sandbox

  • deepin v20 开发环境搭建

    基本介绍:

    deepin v20 默认安装 开源版的Chrome浏览器(Chromium浏览器,不支持Flash)需要Flash请自行安装原版

    系统默认安装:proxychains 命令 (给个赞)

    没有预装WPS,升级QQ的方法(确保使用bash):
    env $WINEPREFIX=~/.deepinwine/Deepin-QQ deepin-wine PCQQ.exe(安装包)

    Github加速访问网络工具请自行用bing.com搜索 关键字 : ele ssr 第一个就是你需要的,使用uGet 开启16线程下载速度会好些。

    开发工具:

    应用商店自带:微信小程序开发工具(支持云开发) VSCode JB全家桶 Eclipse Android Studio

    JDK安装:sudo apt install openjdk-11-jdksudo apt install openjdk-8-jdk
    Python:推荐使用 Anaconda Pycharm

  • deepin v20 双显卡笔记本新手上车指南

    ISO下载:https://mirrors.nju.edu.cn/deepin-cd/20Beta/deepin-20Beta-desktop-amd64.iso

    安装盘推荐工具:http://www.ventoy.net/index.html

    grub参数:
    nouveau.modeset=0 ipv6.disable=1

    nouveau.modeset=0是为了禁用nvidia开源驱动防止画面冻结 ;ipv6.disable=1 禁用ipv6是为了让wineQQ图片正常显示。

    1.在grub安装引导界面按e键进入编辑

    2.在splash quiet代码后面添加上述2个参数 nouveau.modeset=0 ipv6.disable=1

    3.按F10引导开始安装。

    4.安装完毕后重启的时候(此时还没设置系统账号),按上述操作再次修改grub引导参数

    5.登录系统,按Ctrl Alt T打开终端。

    6.输入sudo dedit /etc/default/grub ;此时要求输入密码(登录密码,输入时不会显示密码,输入完成直接回车即可)。

    7.将上述代码按同样要求添加到该文件

    # Written by com.deepin.daemon.Grub2
    DEEPIN_GFXMODE_ADJUSTED=1
    GRUB_BACKGROUND="/boot/grub/themes/deepin/background.jpg"
    GRUB_CMDLINE_LINUX=""
    GRUB_CMDLINE_LINUX_DEFAULT="splash quiet nouveau.modeset=0 ipv6.disable=1"
    GRUB_DEFAULT=0
    GRUB_DISTRIBUTOR="`/usr/bin/lsb_release -d -s 2>/dev/null || echo Deepin`"
    GRUB_GFXMODE=1920x1080
    GRUB_THEME="/boot/grub/themes/deepin/theme.txt"
    GRUB_TIMEOUT=5

    8.终端输入sudo update-grub 更新

    9.打开 设置>鼠标>鼠标>插入鼠标时禁用触控板

    10.打开 设置>声音>系统音效 取消开机&关机音效

    启用nvidia官方显卡驱动方法与上一篇文章相同:https://seq.ink/all/2643.html

  • ventoy启动盘神器-启动任意iso文件进行安装

    http://www.ventoy.net/index.html
    具体使用方法
    screen_uefi

    源码地址:
    
    git clone https://gitee.com/longpanda/Ventoy.git
    git clone https://github.com/ventoy/Ventoy.git

    特性:

    • 100%开源(许可证)
    • 易于使用(入门)
    • 快速(仅受复制iso文件的速度限制)
    • 直接从iso文件启动,无需解压缩
    • 旧版+ UEFI的支持方式相同
    • 支持大于4GB的ISO文件
    • 旧版和UEFI的本机启动菜单样式
    • 支持大多数类型的操作系统,已测试100多个iso文件
    • 不仅可以启动,还可以完成安装过程
    • “兼容Ventoy”的概念
    • 插件框架
    • 引导期间对USB驱动器只读
    • USB正常使用不受影响
    • 版本升级期间的数据无损
    • 发行新发行版时无需更新Ventoy
  • 简单链栈 Python

    class Node:
        def __init__(self,data,next):
            self.data=data
            self.next=next
    class LinkStack:
        def __init__(self):
            self.top=Node(None,None)
    
        def IsEmpty(self):
            if self.top.next==None:
                print('当前状态:空栈')
                return True
            else:return False
    
        def PushStack(self,d):
            for i in d:
                self.top=Node(i,self.top)
                print(i,end=' ')
                # print('mk:',self.top.data,self.top,self.top.next)
            print()
    
        def PopStack(self):
            if self.IsEmpty():
                return
            else:
                print(self.top.data,self.top)
                self.top=self.top.next
    
        def GetTop(self):
            if self.IsEmpty():
                return
            else:
                print('当前状态:顶栈值为',self.top.data,self.top)
                return self.top.data
    
    
    
    print('当前状态:初始化链栈')
    LS=LinkStack()
    LS.IsEmpty()
    print('当前状态:依次进栈 ',end=' ')
    LS.PushStack([2,4,6])
    LS.GetTop()
    print('当前状态:依次出栈:')
    LS.PopStack()
    LS.PopStack()
    LS.PopStack()
    
    
  • ‘staticfiles’ is not a registered tag library

    访问原文

    ‘staticfiles’ is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz

    原因:django 3 已经弃用

    staticfiles现在已弃用,您必须以{% load static %}旧方式加载它{% load static from staticfiles %}

    https://docs.djangoproject.com/zh-CN/1.9/ref/templates/builtins/#std:templatetag-static
    3.0版的发行说明
    https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-3-0
    该staticfiles和admin_static模板标签库将被删除。
  • django 向数据库放入一些初始化数据

    假设我们需要在django初始化的时候在数据库提前放谢数据用来测试。
    比如:数据库里有一张叫 [site_option] 里面有3个字段 [id] [option_name] [option_value],
    我们现在需要在启动django之前向这张表添加1条数据,之后我们需要在Views里获取博客的名称:

    index_site_option
    id option_name option_value
    1 blog_name 这里是F_picachoの领域(๑•̀ㅂ•́)و✧

    我们先在app目录下创建一个名叫fixtures的文件夹,现在的目录是这样的:

    .
    ├── index (app的名字)
    │   ├── admin.py
    │   ├── apps.py
    │   ├── fixtures (我们需要创建的文件夹)
    │   │   └── initial_data.json(初始化json数据)
    │   ├── __init__.py
    │   ├── migrations

    其中initial_data.json的名字可以随意起 比如简化成 init.json

    现在假设你有一个叫site_option的模型

    class site_option(models.Model):
        option_name=models.CharField(max_length=50)
        option_value=models.CharField(max_length=100)
    

    那么init.json可以这样写:

    [
     {
       "model": "index.site_option", //index是app的名称,site_option是模型的名称
       "pk": 1, //primary key 的简写
       "fields": { //里面是你需要添加的数据
         "option_name":"blog_name",
         "option_value": "这里是F_picachoの领域(๑•̀ㅂ•́)و✧"
       }
     }
    //如果想再加1条。
     {
        "model": "index.site_option",
        "pk": 2,
        "fields": {
          "option_name": "blog_url",
          "option_value": "https://seq.ink"
        }
      }
    ]
    
    现在我们初始化数据:
    python manage.py loaddata init.json
    
    PS:这里我们不需要写init.json的具体目录,但需要确保它位于 app 目录下的 fixtures 目录
    
    
  • Django 误删migrations后重建数据库

    python manage.py makemigrations –empty [app_name]

    python manage.py makemigrations

    python manage.py migrate