随笔分类 -  Python

摘要:在centos上运行django,报错: django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17). django.db.utils.NotSupportedError: 阅读全文
posted @ 2022-09-23 16:01 十一的杂文录 阅读(1051) 评论(0) 推荐(0) 编辑
摘要:1. 进入到项目的根目录,编写 uwsgi.xml 配置文件 *:centos用的不是 uwsgi.ini,而是 uwsgi.xml <uwsgi> <socket>127.0.0.1:8997</socket><!-- 内部端口,自定义 --> <chdir>/huyang/mysite/</ch 阅读全文
posted @ 2022-09-23 15:48 十一的杂文录 阅读(96) 评论(0) 推荐(0) 编辑
摘要:1. 上传项目 用 ftp 或者 sftp 上传项目到服务器。 *:如果上传时,报各种错误,可以考虑下是不是服务器中文件夹权限的问题。如果是权限的问题,可以使用命令修改文件夹权限后在上传:chmod 777 dirName 2.安装项目需要的各种库 比如: pip3 install django p 阅读全文
posted @ 2022-09-23 15:28 十一的杂文录 阅读(50) 评论(0) 推荐(0) 编辑
摘要:前言: 参考文档: https://www.cnblogs.com/djangocn/p/9538551.html https://www.icode9.com/content-3-546765.html Python 、 nginx 下载地址: Python下载地址:https://www.pyt 阅读全文
posted @ 2022-09-23 15:16 十一的杂文录 阅读(61) 评论(0) 推荐(0) 编辑
摘要:1. uwsgi 1.1 项目结构如下,你要知道 uwsgi.ini 放在什么位置 projectName |-- app |-- projectName |-- -- wsgi.py |-- -- settings.py |-- uwsgi.ini 1.2 在项目根目录下新建 uwsgi.ini 阅读全文
posted @ 2022-09-06 17:55 十一的杂文录 阅读(191) 评论(0) 推荐(0) 编辑
摘要:首先将我们开发好的工程代码上传到服务器(Ubuntu) 用命令启动,然后进去浏览器检查,看看是否能正常启动 python3 manage.py runserver 如果 settings.py 中 debug=True,访问网页都是正常 但是 settings.py 中 debug=False,访问 阅读全文
posted @ 2022-09-06 17:41 十一的杂文录 阅读(136) 评论(0) 推荐(0) 编辑
摘要:前言: Ubuntu系统上部署django,使用的部署方案是 Ubuntu + django + uwsgi + nginx Ubuntu系统版本用的是 ubuntu-20.04.2.0-desktop-amd64 *:所有的安装尽量都在 root 用户下安装,不然后面会有很多麻烦 前置条件: 准备 阅读全文
posted @ 2022-09-06 17:37 十一的杂文录 阅读(574) 评论(0) 推荐(0) 编辑
摘要:目前Python格式化字符串的方式有三种: 1. % 2.format 3.f-string % 格式化常用方法: # % 格式化字符串 s1 = 'name is %s' % ('zhangsan') # >>> name is zhangsan # % 格式化整数 s2 = 'age is %d 阅读全文
posted @ 2022-08-05 09:57 十一的杂文录 阅读(527) 评论(0) 推荐(0) 编辑
摘要:今天客户在用Python调用我们的动态库的时候,遇到一个问题,调用动态库中的函数,函数返回的是BSTR字符串,但是客户接收到的是一个8位长度的数字。 动态库函数原型:EXTERN_C BSTR ELOAMAPI EloamGlobal_GetIdCardData(LONG flag) 解决这个问题可 阅读全文
posted @ 2022-05-24 11:34 十一的杂文录 阅读(183) 评论(0) 推荐(0) 编辑
摘要:# mytest.py class Test: def hello(self): print("this is test class hello function no params return 123") return 123 def myadd(self, x, y): print("this 阅读全文
posted @ 2022-04-02 17:30 十一的杂文录 阅读(197) 评论(0) 推荐(0) 编辑
摘要:# mytest.py def myjoin(a, b): print("num a + str b") return f"{a}=={b}" #include "Python.h" #include <iostream> using namespace std; int main(int argc 阅读全文
posted @ 2022-04-02 17:29 十一的杂文录 阅读(184) 评论(0) 推荐(0) 编辑
摘要:# mytest.py def myadd(a, b): print("this is test python print add function") return a+b #include "Python.h" #include <iostream> using namespace std; i 阅读全文
posted @ 2022-04-02 17:27 十一的杂文录 阅读(107) 评论(0) 推荐(0) 编辑
摘要:# mytest.pydef hello1(): print("this is test python print hello world 1") return "456" #include "Python.h" #include <iostream> using namespace std; in 阅读全文
posted @ 2022-04-02 17:25 十一的杂文录 阅读(573) 评论(0) 推荐(0) 编辑
摘要:# mytest.py def hello(): print("this is test python print hello world") return 123 #include "Python.h" #include <iostream> using namespace std; int ma 阅读全文
posted @ 2022-04-02 17:24 十一的杂文录 阅读(154) 评论(0) 推荐(0) 编辑
摘要:#include "Python.h" #include <iostream> using namespace std; int main(int argc, char* argv[]) { Py_Initialize(); if (!Py_IsInitialized()) { cout << "初 阅读全文
posted @ 2022-04-02 17:21 十一的杂文录 阅读(65) 评论(0) 推荐(0) 编辑
摘要:1.进入到Python安装目录 2.将Python安装目录中的 include 和 libs 文件夹放在 C++项目中 3.设置 附加包含目录 和 附加库目录、附加依赖项(python310_d.lib) *: 如果安装的Python是64位的,注意C++编译环境设置成 x64。不然就安装32位Py 阅读全文
posted @ 2022-04-02 17:19 十一的杂文录 阅读(196) 评论(0) 推荐(0) 编辑
摘要:FAQ1:在使用pip3安装库的时候,提示需要升级pip pip3 install --upgrade pip FAQ2:在创建软链接时,提示:ln: failed to create symbolic link ‘/usr/bin/python3’: File exists 我们可以在参数中加个 阅读全文
posted @ 2021-07-11 16:08 十一的杂文录 阅读(182) 评论(0) 推荐(0) 编辑
摘要:服务器是使用的阿里云的centos 7.6 项目使用的是 Python3.9.5 + Django 3.2.4 目标:将django项目部署到centos上,centos + Python + django + uwsgi + nginx Python下载地址:https://www.python. 阅读全文
posted @ 2021-07-11 15:37 十一的杂文录 阅读(315) 评论(0) 推荐(0) 编辑
摘要:核心代码 import compileall compileall.compile_file("a.py", legacy=True, force=True) 演示步骤 1.新建 a.py,定义一个函数,供其他程序调用 # a.py 定义一个函数,提供给其他程序调用 def func(n1, n2) 阅读全文
posted @ 2021-05-25 01:05 十一的杂文录 阅读(596) 评论(0) 推荐(0) 编辑
摘要:这是来自一个妹子的需求,需要将多张图片拼接成一张长图 我是使用pillow这个库来实现的,下面的简单的代码,操作比较简单,代码还有优化的空间 def test(dirpath): ims = [Image.open(os.path.join(dirpath, i)) for i in os.list 阅读全文
posted @ 2021-05-04 16:36 十一的杂文录 阅读(87) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示