Giter Club home page Giter Club logo

Comments (6)

sergeyklay avatar sergeyklay commented on May 26, 2024 2

I'm not super familiar with this package and why it has its own pathlib-alike (guessing it pre-dates py3?), but I think I'd suggest removing it since it appears to have bugs and (probably?) isn't necessary anymore. Instead, we could pretty easily, I think, migrate people to pathlib in their settings, though that'd be a backwards incompatible change.

This is on my plans, but right now I don't have enough time for that. I'll try to return to this topic a bit later

from django-environ.

mlissner avatar mlissner commented on May 26, 2024 1

I ran into this bug too. I haven't read all of environ's source code, but for us this happened because we had a setting configured using env.Path, and then we had it overridden in a django test via a decorator, like so:

@override_settings(
    MEDIA_ROOT=os.path.join(settings.INSTALL_ROOT, "cl/assets/media/test/")
)

Something about that combination made the built in env.path thing try to compare one of its Path objects with a str, which failed, as in the first comment.

The solution, which you can see here was to not use environ's path objects, and instead rely on pathlib.

I'm not super familiar with this package and why it has its own pathlib-alike (guessing it pre-dates py3?), but I think I'd suggest removing it since it appears to have bugs and (probably?) isn't necessary anymore. Instead, we could pretty easily, I think, migrate people to pathlib in their settings, though that'd be a backwards incompatible change.

from django-environ.

raccoonyy avatar raccoonyy commented on May 26, 2024

I solved this problem by str(root.path('path')) instead of root.path('path').root

from django-environ.

daimon99 avatar daimon99 commented on May 26, 2024

I think you still use path the wrong way.
You should use like this:

STATIC_ROOT = root('collected_static')

but not

STATIC_ROOT = root.path('collected_static')

When you need a str object, you should use root('sub path'), when you wanta a Path object to chain it, you should use root.path('sub path')

from django-environ.

raccoonyy avatar raccoonyy commented on May 26, 2024

wow!

Thanks for your reply.

You are correct.

from django-environ.

axelkolo avatar axelkolo commented on May 26, 2024

t

from django-environ.

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.