Giter VIP home page Giter VIP logo

Comments (2)

browniebroke avatar browniebroke commented on June 19, 2024

We have a set of issue templates, please help us help you: follow them to report a bug, they have questions we really need answers from, otherwise it's hard to answer.

Might be related to #4209 which OP mentioned a permission issue:

in order to create my own media folder with django:django as the owner:group, because in the PR doesn't include the media folder creation and when I build containers this media folder was created with root:root ownership, so my django app crashed when I tried to upload any file because doesn't have permissions to write on that folder.

from cookiecutter-django.

Tshibek avatar Tshibek commented on June 19, 2024

From the above just did

The only one modification I made was in /compose/production/django/Dockerfile, I added this line: RUN mkdir ${APP_HOME}/proveemax/media && chown django:django ${APP_HOME}/proveemax/media
I think @edwardigarashi might be onto something. The rule for web-media-router needs to have priority over the rule for web-secure-router. Traefik looks at the rule length to determine this when no explicit priority is set.

These rules are defined in this file (traefik.yml).

Adding a high priority like 1000 (just has to be higher than the length of the rule in web-secure-router) will make Traefik prioritize this rule.

    web-media-router:
      rule: "Host(`{{ cookiecutter.domain_name }}`) && PathPrefix(`/media/`)"
      entryPoints:
        - web-secure
      middlewares:
        - csrf
      service: django-media
      tls:
        certResolver: letsencrypt
      priority: 1000

Alternatively, you can manually set the priority for both rules. Which might be a better solution to merge in case this solves the issue. Or we could even add the www subdomain to the media router rule like this:

rule: "(Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)) && PathPrefix(`/media/`)"

This would always make the media router rule have priority when consistent with the web-secure-router rule.

@maponzzi This is definitely happening in your case. Your first rule has a priority of 70 and the media rule has a priority of 56. So nothing will ever be sent to the media router.

try changing the nginx container from nginx:1.17.8-alpine to nginx:1.23-alpine in the Docker file for nginx and see if that fixes the issue.

from cookiecutter-django.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.