Search code examples
djangodeploymentshimmercat

ShimmerCat - Use ShimmerCat as a reverse proxy for a Django app


I have tested 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/). I am trying to deploy the application locally but a 404 error occurs.

This is the structure of my project:

├── 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

And this is my devlove.yaml file:

shimmercat-devlove:
    domains:
        www.test.com:
            root-dir: testproject
            consultant: 8080
            cache-key: xxxxxxx

I haven't made any changes to settings.py

Do you have any suggestions on how to solve the 404 error? Thank you in advance.


Solution

  • With web-servers, you usually have your static files served by the webserver itself and the dynamic part of the application being proxied by the web server to your application.

    So, a starting setup for your project would be:

    shimmercat-devlove:
        domains:
            static.test.com:
                root-dir: static
                cache-key: xxxxxxx
            www.test.com:
                port: 8080
    

    Everything indented under "static.test.com" would be served as static resources, therefore you need to modify your settings.py file to identify "static.test.com" as your static domain:

    STATIC_URL="https://static.test.com/"
    

    In addition to that, you would need to run your Django application in one of the usual ways, simultaneously with the server. For example, you could start by launching:

    $ python manage.py runserver 
    

    and then in a new terminal invoke ShimmerCat's from the project's directory:

    $ shimmercat devlove