django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured

You must define the relevant variable to show where you settings.py file lives:

export DJANGO_SETTINGS_MODULE=mysite.settings

This is the relevant docs entry:

When you use Django, you have to tell it which settings you’re using. Do this by using an environment variable, DJANGO_SETTINGS_MODULE.

The value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path.

If you are using a virtualenv (which is the best practice), you can paste the relevant export command in the file <path-to-virtualenv>/bin/activate


It happens to me too, I just now found unintentional.

I changed "configuration" in top of PyCharm IDE so pycharm confused when try to run django code. Exactly the problem popup when I try to run server with shortcut but when I used terminal to run server, I found django code not having any problem and pycharm can't found setting.

So please check "configuration" in top pycharm's ide maybe you do same mistake :)

I'm new in django so be calm if my answer was silly.

configuration picture


put this in top of settings.py this will configure django for you

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", __file__)
import django
django.setup()