3.3. 托管服务¶
3.3.1. netlify¶
3.3.2. jsdelivr¶
使用格式:
// load any GitHub release, commit, or branch
// note: we recommend using npm for projects that support it
https://cdn.jsdelivr.net/gh/user/repo@version/file
实例: https://cdn.jsdelivr.net/gh/zhaoweiguo/repo@latest/index.html
3.3.3. itclan¶
3.3.4. PythonAnywhere¶
配置虚拟环境和安装依赖:
在Bash控制台中,创建一个Python虚拟环境: mkvirtualenv <name> --python=/usr/bin/python3.x # 替换x为你的Python版本 激活虚拟环境,并安装项目依赖: workon <name> pip install -r /home/yourusername/spb/requirements.txt
更新Web应用程序的配置:
在 Web 配置页面,设置虚拟环境路径: /home/yourusername/.virtualenvs/spb-venv/
使用console进入终端:
修改文件 /var/www/xinxi_pythonanywhere_com_wsgi.py 1. 注释其他所有 2. 增加: import sys path = '/var/www/babyscore' if path not in sys.path: sys.path.append(path) from babyscore.app import app as application # noqa
使用webapp,修改:
Working directory Source code:
fastapi(ASGI)如何使用¶
# 1. YOURUSERNAME改成你的用户名 /home/YOURUSERNAME/.virtualenvs/my_venv/bin/uvicorn –app-dir /home/YOURUSERNAME/my_fastapi –uds ${DOMAIN_SOCKET} main:app
pa website create –domain xinxi.pythonanywhere.com –command ‘/home/xinxi/.virtualenvs/my_venv/bin/uvicorn –app-dir /home/xinxi/xixi_api2 –uds ${DOMAIN_SOCKET} main:app’ /home/xinxi/.virtualenvs/my_venv/bin/uvicorn –app-dir /home/xinxi/xinxi_api –uds ${DOMAIN_SOCKET} main:app