How can I correctly set DJANGO_SETTINGS_MODULE for my Django project (I am using virtualenv)?

后端 未结 7 1655
误落风尘
误落风尘 2020-12-07 21:22

I am having some trouble setting the DJANGO_SETTINGS_MODULE for my Django project.

I have a directory at ~/dev/django-project. In this directory I have

7条回答
  •  隐瞒了意图╮
    2020-12-07 21:33

    Yet another way to do deal with this issue is to use the python dotenv package and include PYTHONPATH and DJANGO_SETTINGS_MODULE in the .env file along with your other environment variables. Then modify your manage.py and wsgi.py to load them as stated in the instructions.

    from dotenv import load_dotenv
    load_dotenv()
    

提交回复
热议问题