ShimmerCat - 使用 ShimmerCat 作为 Django 应用程序的反向代理
ShimmerCat - Use ShimmerCat as a reverse proxy for a Django app
我测试了 ShimmerCat (https://www.shimmercat.com/) and sc-tool (https://pypi.python.org/pypi/sc-tool/) using this (https://www.shimmercat.com/en/info/articles/getting-started/)。我正在尝试在本地部署应用程序,但出现 404 错误。
这是我项目的结构:
├── db.sqlite3
├── devlove.yaml
├── manage.py
├── testapp
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ │ └── home.html
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── testproject
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
└── static
│ ├── base.css
这是我的 devlove.yaml 文件:
shimmercat-devlove:
domains:
www.test.com:
root-dir: testproject
consultant: 8080
cache-key: xxxxxxx
我没有对 settings.py
做任何更改
对于如何解决 404 错误,您有什么建议吗?先感谢您。
对于网络服务器,您通常让网络服务器本身为您的静态文件提供服务,而应用程序的动态部分则由网络服务器代理到您的应用程序。
因此,您项目的初始设置为:
shimmercat-devlove:
domains:
static.test.com:
root-dir: static
cache-key: xxxxxxx
www.test.com:
port: 8080
"static.test.com" 下缩进的所有内容都将用作静态资源,因此您需要修改 settings.py
文件以将 "static.test.com" 标识为您的静态域:
STATIC_URL="https://static.test.com/"
除此之外,您还需要以一种常用的方式 运行 您的 Django 应用程序,与服务器同步。例如,您可以先启动:
$ python manage.py runserver
然后在新终端中从项目目录调用 ShimmerCat:
$ shimmercat devlove
我测试了 ShimmerCat (https://www.shimmercat.com/) and sc-tool (https://pypi.python.org/pypi/sc-tool/) using this (https://www.shimmercat.com/en/info/articles/getting-started/)。我正在尝试在本地部署应用程序,但出现 404 错误。
这是我项目的结构:
├── db.sqlite3
├── devlove.yaml
├── manage.py
├── testapp
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ ├── models.py
│ ├── templates
│ │ └── home.html
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── testproject
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
└── static
│ ├── base.css
这是我的 devlove.yaml 文件:
shimmercat-devlove:
domains:
www.test.com:
root-dir: testproject
consultant: 8080
cache-key: xxxxxxx
我没有对 settings.py
做任何更改对于如何解决 404 错误,您有什么建议吗?先感谢您。
对于网络服务器,您通常让网络服务器本身为您的静态文件提供服务,而应用程序的动态部分则由网络服务器代理到您的应用程序。
因此,您项目的初始设置为:
shimmercat-devlove:
domains:
static.test.com:
root-dir: static
cache-key: xxxxxxx
www.test.com:
port: 8080
"static.test.com" 下缩进的所有内容都将用作静态资源,因此您需要修改 settings.py
文件以将 "static.test.com" 标识为您的静态域:
STATIC_URL="https://static.test.com/"
除此之外,您还需要以一种常用的方式 运行 您的 Django 应用程序,与服务器同步。例如,您可以先启动:
$ python manage.py runserver
然后在新终端中从项目目录调用 ShimmerCat:
$ shimmercat devlove