django error cannot import name 'RemovedInDjango30Warning'

Comment out the following line:

from django.utils.deprecation import RemovedInDjango30Warning

in the files below:

python3.6/site-packages/django/contrib/admin/templatetags/admin_static.py
python3.6/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py

This is caused by conflicts in Django versions as seen here.

ImportError: cannot import name 'RemovedInDjango30Warning'

Try uninstalling django

sudo pip uninstall django

and reinstall with a version lower than 3.0

sudo pip install django==2.2

Edit

If you wish to use different versions of Django you can use virtual environments.

First create a requirements.txt example from here

You can generate your project’s requirements by running the pip freeze command that lists all packages that are installed in your local machine with their versions.

pip freeze > requirements.txt

Do note that this process can lead to certain unnecessary packages being written to the requirements file which are installed in your local machine but not required for the project. You must manually edit the requirements file in that case.

Then create your virtual environment

Step 1 install virtualenv

pip install virtualenv

Step 2 create virtual enviroment

virtualenv env

Step 3 Activate your environment

env\Scripts\activate

When you wish to deacitvate

deactivate

Step 4 Edit your requirements.txt to have the packages you'll need for your project.

Step 5 install requirements.txt (in same dir)

pip install -r requirements.txt

Form infomation on deployment with mod_wsgi and Apache try here


This is caused by django versions. You probably upgraded it.

If you do not want to go back to version 2, create a virtual environment and do pip install django==2.2


This appears to be from a corrupt Django installation in site-packages. Remove Django and install it again.

For me, I was upgrading an existing project from Django 2.2.6 to 3.1.7. It appears that somehow files from 2.2.6 were still hanging around. I had to run pip uninstall django twice to get back to a clean slate and then pip install django to install the latest version.