Tutorial App
help app
tutorial update
作者: n5321
tutorialtest下面的App感觉基本可用,考虑正式在mysite应用!
直接把相关scripts copy and past 进 mysite
报错ModuleNotFoundError: No module named 'tutorialsfiler'
语法错误:修改
INSTALLED_APPS
,在'tutorials'
后面加上逗号:
requirements.txt里面的东西更新得足够吗?
tutorials的设计:
最初的目的是做AutoEM的help,需要一个online的help来创造客户,解决客户的疑问。在结构上就期望类似SolidWorkshelp。左侧是sidebar,大目录,中间是内容,右侧是考虑通过JS生成副标题link,再添加一个search。方便用户可以快速理解、使用AutoEM的工具。
一个card结构的list。暂时在结构上是能够接受的。当然还需要再弄漂亮一点!
在creat上面就需要分类,一个tutorial create 一个chapter create
在edit and delete上也同样需要两类
有技术含量的内容是需要增加一个版本控制器。
Debug的思路!从什么地方开始?尝试从view开始
tutorials_detail :bug,AJAX没有发挥效果,href没有插入进去!
tutorial and chapter都是内容,都应该有author,是要有固话!
不对,开始是想搞两个视图(1个tutorial detail 1个chapterdetail)
暂时搞定tutorial 页面。
update create tutorial页面
是否要用crispy工具。html代码少了很多,有点不清楚它的logic怎么实现的。这是问题。推荐的理由是django example and chatgpt推荐。——结论还是用这个工具
pip install django-crispy-forms -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install crispy-bootstrap5 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
问题:image存放的位置!包括未来的图片管理问题
information structure的设计
features(chapter的管理)
在视觉效果上跟那个是一样的,但是还是需要一个新的不一样的edit页面
加了好多东西,感觉好了很多。
加一个delete页面。(下午搞)——已添加,暂时感觉还不错
list页面的card太丑了。需要update!
order那里还有一个小bug!如果中间删了一个order的话,缺一个list页面来同意改order!现在设置了一个逻辑在里面,要好好想一下到底要不要改!
增加books App(用fileshare好像不喜欢了)
添加PyMuPDF: pip install pymupdf -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
books App的东西基本是在理解概念以后搭的。基本上直接挪过去就可以用了。算是一个小意外!
2025.3.5直接把update的内容部署到腾讯云上去了。出现两个bug
用的http,所以一直谈bug,说Cross-Origin-Opener-Policy的问题。为了屏蔽这个功能,在settings.py之中添加SECURE_CROSS_ORIGIN_OPENER_POLICY = None 并且考虑在Nginx配置里添加 #add_header Cross-Origin-Opener-Policy "unsafe-none" always;
location / {
proxy_pass http://124.220.90.88:8000; # 假设你的应用运行在此端口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cross-Origin-Opener-Policy "unsafe-none" always;
}Nginx的原始配置如下(备用)
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#以上update以后,可以上传,但是有文档限制,在1M以内。提示明确是nginx的限制
在
http
块中添加或修改client_max_body_size
指令。您可以将其放在http
块的任何位置,通常放在块的开头或末尾,如下所示:nginx复制编辑http {
client_max_body_size 150M;
# 其他配置
}一开始做的这个: 结果无效:2. 在
server
块中设置(针对特定的 server 配置)如果只希望为某个特定的 server 设置限制,可以将该指令放在
server
块中:nginx复制编辑server {
listen 80 default_server;
listen [::]:80 default_server;
client_max_body_size 150M;
# 其他配置...
}
暂时解决问题!