158๐
You might have decouple installed in additional to python-decouple (two different packages).
If that is the case simply uninstall decouple
pip uninstall decouple
And ensure you have python-decouple installed
pip install python-decouple
7๐
The error happens because your python interpreter is looking for python-decouple
package instead of decouple
Uninstall the existing package using this command
pip uninstall decouple
And then install
pip install python-decouple
- [Django]-Difference between filter with multiple arguments and chain filter in django
- [Django]-ChoiceField in Django model
- [Django]-Tailwindcss: fixed/sticky footer on the bottom
1๐
It shows the error because you are not installed the module python-decouple
Just run pip install -r requirements.txt
If it wonโt work then try it in env
pip install python-decouple
- [Django]-How to export virtualenv?
- [Django]-Django template display item value or empty string
- [Django]-Django: Fat models and skinny controllers?
0๐
I was using pipenv to create a virtual environment and run the Django project
pipenv install -r requiremnts.txt
pipenv shell
python manage.py runserver
Interestingly above method kept throwing error that it cannot import config from decouple
then I tried:
python -m venv myEnv
myEnv/Scripts/activate
pip install -r requirements.txt
python manage.py runserver
and this ran the project successfully. I didnt understand why this would happen as I am doing pretty much same just using pip instead of pipenv.
- [Django]-Django's forms.Form vs forms.ModelForm
- [Django]-Supervising virtualenv django app via supervisor
- [Django]-How to show ALL keys through redis-cli?
0๐
I encountered the same issue, and in my case, it was caused by a conflict between "decouple" and "python-decouple" packages (I had installed both of them by mistake). As the latter creates a file called "decouple.py" in the installation virtual environment, finding the package of the same name, this will confuse the Django app of which of the 2 decouple reference it will consider. To fix this I had to uninstall the "decouple" package with pipenv uninstall decouple
and install the "python-decouple" package with pipenv install python-decouple
.
...
class AutoConfig(object):
"""
Autodetects the config file and type.
Parameters
----------
search_path : str, optional
Initial search path. If empty, the default search path is the
caller's path.
"""
...
# A prรฉ-instantiated AutoConfig to improve decouple's usability
# now just import config and start using with no configuration.
config = AutoConfig()
# Helpers
...
- [Django]-How to get a list of all users with a specific permission group in Django
- [Django]-Upload image available at public URL to S3 using boto
- [Django]-How to get full url from django request
0๐
I struggled with this for a good hour, the fix was to close the current bash/terminal window and opening a new one.
- [Django]-ModuleNotFoundError: No module named 'grp' on windows
- [Django]-How to add new languages into Django? My language "Uyghur" or "Uighur" is not supported in Django
- [Django]-How to call function that takes an argument in a Django template?
0๐
After trying almost everything, installing the python-decouple for the whole system, as opposed to in an environment, worked for me. So left the virtual environment, installed python-decouple then activated back my environment again. It works for me.
Let me know if this helps.
- [Django]-How to limit the maximum value of a numeric field in a Django model?
- [Django]-Django serializer Imagefield to get full URL
- [Django]-How to get request object in django unit testing?
0๐
It shows the error because you have not installed the python-decouple
module. Just run:
pip uninstall decouple
Then try
pip install python-decouple
- [Django]-Why does my Django admin site not have styles / CSS loading?
- [Django]-Why is Django throwing error "DisallowedHost at /"?
- [Django]-Django : DRF Token based Authentication VS JSON Web Token
0๐
In my case, the issue was with the selection of interpreter. In Visual Studio Code, CMD+Shift+P and type: โSelect Interpreterโ, and then select the correct interpreter for the virtual environment.
- [Django]-Django max_length for IntegerField
- [Django]-VueJS + Django Channels
- [Django]-Problems extend change_form.html in django admin