Solution :
Depending on how you got above error (serving django through the wsgi server or on a command line), you need to check for manage.py
or wsgi.py
to see what is your name of a default settings file.
If you want to do it manuallly then set the settings to use, use something as shown below :
./manage.py --settings=production
Where the production
means any python module.
Please note, your settings file should not import anything the django related. If you want to split the settings for your different environments, then use something as shown below.
A file is settings/base.py
# All the settings are common to all environments
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
Files like the settings/local.py
, settings/production.py
…
# The Production settings
from settings.base import *
DEBUG = False
DATABASES = …
OR
Set a STATIC_ROOT setting to your directory from which you would like to serve your files, for e.g.:
STATIC_ROOT = "/var/www/example.com/static/"
The settings which you are using are for the development. Please check the Django docs for the more information here