Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import error django corsheaders

i am a beginner in django. i am doing project based on it. project has two stages. i completed first phase and uploaded the code to amazon ec2 instance. after completing second phase i added some packages like python-social-auth, django-cors-headers, django-easy-maps, crispyforms. but now it is showing import error for corsheaders and this the traceback i have checked virtual environment and corsheaders package is ther

Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in execute translation.activate('en-us') File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 130, in activate return _trans.activate(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 188, in activate _active.value = translation(language) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 177, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 159, in _fetch app = import_module(appname) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module __import__(name) ImportError: No module named corsheaders 

any suggestions please

like image 443
shebeer Avatar asked Sep 27 '14 07:09

shebeer


People also ask

What is Corsheaders in Django?

django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).


2 Answers

Using pip :

pip install django-cors-headers 

Using pipenv :

pipenv install django-cors-headers 
like image 118
Rafael Corzo Avatar answered Sep 19 '22 21:09

Rafael Corzo


Try This.

pip install --user django-cors-headers 
like image 39
CPMaurya Avatar answered Sep 20 '22 21:09

CPMaurya