繁体   English   中英

ShimmerCat - 使用 ShimmerCat 作为 Django 应用程序的反向代理

[英]ShimmerCat - Use ShimmerCat as a reverse proxy for a Django app

我已经使用这个( https://www.shimmercat.com/ )测试了 ShimmerCat( https://www.shimmercat.com/ )和 sc-tool( https://pypi.python.org/pypi/sc-tool//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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM