Modulenotfounderror: no module named corsheaders ( Solved )

Corsheaders is an application of Django for handling the server headers required for Cross-Origin Resource Sharing (CORS). If you are getting the error Modulenotfounderror: no module named corsheaders then this post is for you. In this entire tutorial, you will learn how to solve the issue of Modulenotfounderror: no module named corsheaders in a simple way.

What is ModuleNotFoundError ?

Many of the beginners are unable to know the cause of the error ModuleNotFoundError. This type of error mostly comes when you have not properly installed the specific package in your system. Let’s take an example. Suppose you want to use a python package A then if you are using or importing it in your code without installing it then you will get the error Modulenotfounderror: no module named ‘X’. The python interpreter is telling you that you have to install the package in your system before importing it.

What is the cause of Modulenotfounderror: no module named corsheaders

The cause for the problem of the error Modulenotfounderror: no module named corsheaders can be many reasons. But the most obvious reasons are that the django-cors-headers must be corrupt if you have already installed it in your system or you have not installed it in your system. But when you are importing it to use in your code then you will get the error.

Traceback (most recent call last):
File "", line 10, in 
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 399, in execute_from_command_line
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 392, in execute
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/", line 280, in execute
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/", line 130, in activate
return _trans.activate(language)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/", line 188, in activate
_active.value = translation(language)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/", line 159, in _fetch
app = import_module(appname)
File "/usr/local/lib/python2.7/dist-packages/django/utils/", line 40, in import_module
ImportError: No module named corsheaders

Solution for the no module named corsheaders Error

The solution for the no module named corsheaders is very simple. You have to first install the django-cors-headers packages in your system. You have to use the pip or pip3 command depending upon the version of the python in your system.

For python 3. xx

pip3 install django-cors-headers

For python 2. xx

pip install django-cors-headers

After the installation, you have to also Add cors-headers to INSTALLED_APPS like below before using it.


After all the settings now if you import and use the django-cors-headers , then you will not get any module named corsheaders error.

If you are still facing errors then you can contact us for more help.

Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.


This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In: