[Answered ]-Modifying manage.py for development and production

2👍

A good way to control this is using the DJANGO_SETTINGS_MODULE environment variable in the shells where you want to use manage.py.
The default manage.py should not have to change:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

As for the ImportError,
I’m not sure we have enough information to debug it.
But basically you need to make sure that the file is either reachable from the current working directory,
or from a directory on PYTHONPATH.
For example, if you run manage.py from the project’s root,
and project/settings/dev.py exists, then the value “project.settings.dev” should work.

👤janos

Leave a comment