随笔分类 -  django

摘要:sender: django -> dataframe -> to_dict -> JsonResponse -> receiver: django -> result=post.json() -> df = pd.DataFrame(result) -> convert df2dict 阅读全文
posted @ 2022-05-19 09:09 CrossPython 阅读(195) 评论(0) 推荐(0) 编辑
摘要:from django.shortcuts import HttpResponse import psutil from .models.first import func from multiprocessing import Process def index(request): n = 888 阅读全文
posted @ 2022-04-23 20:24 CrossPython 阅读(59) 评论(0) 推荐(0) 编辑
摘要:celery Redis Queue 只需使用一个线程。 import threading t = threading.Thread(target=long_process, args=args, kwargs=kwargs) t.setDaemon(True) t.start() return H 阅读全文
posted @ 2022-04-23 14:52 CrossPython 阅读(572) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-04-23 12:17 CrossPython 阅读(15) 评论(0) 推荐(0) 编辑
摘要:1.设置settings.py DEBUG = False ALLOWED_HOSTS = ["*"] ... STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' 2.修改项目的urls.py from dja 阅读全文
posted @ 2022-02-01 22:53 CrossPython 阅读(871) 评论(0) 推荐(0) 编辑
摘要:Microsoft IIS creates something called AppPool. By default you will have a user IIS AppPool\DefaultAppPool. That user needs to have permissions to you 阅读全文
posted @ 2021-09-28 21:08 CrossPython 阅读(38) 评论(0) 推荐(0) 编辑
摘要:views.py中:定义一个global_settings函数,先把全局变量都引入过来,然后再返回:def global_setting(request):#注意有request参数 SITE_DESC = settings.SITE_DESC SITE_NAME = settings.SITE_N 阅读全文
posted @ 2021-09-28 17:42 CrossPython 阅读(151) 评论(0) 推荐(0) 编辑
摘要:需要依赖库. WeasyPrint,它是一个Python库可以生成PDF文件从HTML模板中。安装WeasyPrint pip install WeasyPrint 创建一个PDF模板(template)我们需要一个HTML文档给WeasyPrint输入。我们将要创建一个HTML模板(templat 阅读全文
posted @ 2019-02-25 21:32 CrossPython 阅读(479) 评论(0) 推荐(0) 编辑
摘要:可以通过开源的Python PDF库ReportLab来实现PDF文件的动态生成。 一、安装ReportLab ReportLab库在PyPI上提供,可以使用pip来安装: $ pip install reportlab 在Python交互解释器中导入它来测试安装: >>> import repor 阅读全文
posted @ 2019-02-25 21:31 CrossPython 阅读(1070) 评论(0) 推荐(0) 编辑
摘要:uwsgi 用来做nginx和应用之间的桥梁,负责接收nginx动态转发过来的用户请求,其配置方式有多种,我一般选择<xml>标签的形式 下面的这些配置仅限于ubuntu下用apt-get安装的形式: 进入/etc/uwsgi/目录,有两个目录分别为apps-available和apps-enabl 阅读全文
posted @ 2019-02-23 19:31 CrossPython 阅读(1376) 评论(0) 推荐(0) 编辑
摘要:settings: STATIC_URL = 'static/'STATIC_ROOT = os.path.join(BASE_DIR, 'static') urls: from django.conf import settingsfrom django.conf.urls.static impo 阅读全文
posted @ 2019-02-07 18:25 CrossPython 阅读(223) 评论(0) 推荐(0) 编辑