Comments (6)
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.
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.
I solved this problem by str(root.path('path'))
instead of root.path('path').root
from django-environ.
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.
wow!
Thanks for your reply.
You are correct.
from django-environ.
t
from django-environ.
Related Issues (20)
- link in BACKERS.rst is broken causing the CI to break
- Environment variables' reimports not supported HOT 1
- Officially support Django 4.2 and Python 3.12 on PyPI HOT 1
- Ask for next release HOT 1
- v0.11.0 Introduces parsing error for strings containing more than one $ symbol HOT 6
- v0.11.1: $-symbol issue HOT 5
- v0.11.0/ v0.11.1 breaks on Mac OSX HOT 1
- UserWarning: Engine not recognized from url : sqlite3 HOT 3
- Path issues with read_env since 11.0+ HOT 11
- Simplicity and Stability vs Advanced Features HOT 2
- Hash sign inside double quotes is interpreted as the start of a comment HOT 5
- Deprecated Code from python 2.x to 3.x HOT 1
- db_url() fail with oracle dsn
- db support for CockroachDB HOT 1
- Wrong missing environment variable name if using prefix HOT 1
- Django's RedisCache OPTIONS needs to be lowercase
- Double quotes no longer work for including the `#` in a string HOT 5
- ModuleNotFoundError: No module named 'environ'
- Support new db option `pool` in Django 5.1
- Restore defaults in .env HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-environ.