justdjango / django-ecommerce

An e-commerce website built with Django
GNU General Public License v3.0
2.07k stars 1.61k forks source link

ImportError: cannot import name 'config' from 'decouple' #45

Closed salman77713438 closed 4 years ago

salman77713438 commented 4 years ago

i got this error when i try to runserver please help!!!!!!!!!!!!!! my steps 1- pip install virtualenv 2- virtualenv env 3- source env/bin/active 4- pip install -r requirements.txt 5- python manage.py runserver

`_Traceback (most recent call last): File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute super().execute(*args, *options) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 364, in execute output = self.handle(args, options) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle if not settings.DEBUG and not settings.ALLOWED_HOSTS: File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf__init.py", line 79, in getattr self._setup(name) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf__init__.py", line 66, in _setup self._wrapped = Settings(settings_module) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf__init.py", line 157, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib\init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in from .base import * File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in from decouple import config ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple\init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management__init.py", line 381, in execute_from_command_line utility.execute() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv connections.close_all() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 219, in close_all for alias in self: File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 213, in iter return iter(self.databases) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 147, in databases self._databases = settings.DATABASES File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf__init.py", line 79, in getattr self._setup(name) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf__init__.py", line 66, in _setup self._wrapped = Settings(settings_module) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf\init.py", line 157, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib\init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in from .base import * File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in from decouple import config ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple\init_.py)`

sakibsadmanshajib commented 4 years ago

I think you might have misconfigured your virtual environment or some packages aren't being installed properly. I ran the program myself. It sorta worked. Let me know if I can help.

zeeshan606115 commented 4 years ago

The same error is showing to me also

zeeshan606115 commented 4 years ago

I think you might have misconfigured your virtual environment or some packages aren't being installed properly. I ran the program myself. It sorta worked. Let me know if I can help.

Bro can u please show me the python packages which you have installed.

ghost commented 4 years ago

i got this erro also

ghost commented 4 years ago

i got it pepole first activate ther virtual enviroment run this => pip uninstall decouple and run this => from .conf import con

this soulution worked with me

alexshcer commented 3 years ago

image

alexshcer commented 3 years ago

Help it is showing this error

vincent50 commented 3 years ago

Hi! you need install python-decouple not decouple

if you have installed decouple first uninstall with: pip uninstall decouple

then install python-decouple: pip install python-decouple

or only replace the requirements file with: python-decouple==3.4

rkovilpillai commented 3 years ago

Thanks @vincent50 , Your solution helpmed to fix the error !!

JanakXD commented 3 years ago

Hi! you need install python-decouple not decouple

if you have installed decouple first uninstall with: pip uninstall decouple

then install python-decouple: pip install python-decouple

or only replace the requirements file with: python-decouple==3.4

thanks @vincent50 this helped me too

Parl-Shedge commented 2 years ago

you have to install :
step 1:

pip install python-decouple

if you have install

pip install decouple (uninstall it first) then follow step 1 :