
1.编写网站源文件index文件网页源代码app.py文件上传api_key展示网页接收ds回答传回网页2.使用后端调用方案获取API key编写后端代码AI生成运行app.py文件此处出现错误无法下载部分库错误原因Centos系统内置为python版本低于3.6解决方法将更换服务器为Ubuntu系统//部分报错内容 C:\Users\Admin01\Desktop\webpip install flask-cors Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple ERROR: Could not find a version that satisfies the requirement flask-cors (from versions: none) ERROR: No matching distribution found for flask-cors运行后进入http://127.0.0.1:5000即可在本地访问网站3.将网站部署至云服务器使用XSHELL连接至云服务器在服务器中安装环境和网站依赖此处出现错误无法下载部分依赖错误原因Centos系统内置为python版本低于3.6解决方法将更换服务器为Ubuntu系统//部分报错代码 Could not find a version that satisfies the requirement pandas1.2.3 (from openai) (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5) No matching distribution found for pandas1.2.3 (from openai)此处出现错误无法下载部分依赖错误原因 Ubuntu系统限制直接使用pip安装系统包解决方法创建独立的虚拟环境重点报错代码error: externally-managed-environmentError: Unable to locate package flask Error: Unable to locate package flask-cors Error: Unable to locate package openai rootiZbp1aj7736y0d7s8zt854Z:~/my_chat_website# pip3 install flask flask-cors openai error: externally-managed-environment × This environment is externally managed ╰─ To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.14/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.设置环境变量保护API KEY启动app.py程序尝试用公网IP访问网站此处出现错误访问公网地址拒绝连接错误原因 服务器尚未开放5000端口**解决方法入规则管理中打开5000端口此处出现错误本地地址能正常访问但是无法从公网地址访问错误原因 两次访问的端口不一致**解决方法Nginx反向代理将子域名转发到本地的5000端口多次尝试后网站终于成功运行4.总结与感悟因课程需要尝试搭建网站从查找教程到网站上线总共用了六天。网站源代码以及连接用的app.py均为AI生成。AI的功能确实非常强大但仍会给出前后不一致的回答。通过多次追问能够解决这一问题。很难想象没有AI的帮助手敲网站代码需要多久未来工作后大部分的代码应该都会由AI来实现但是程序员仍然要熟悉代码的语法以便于改错。