Django Shell No module named settings

后端 未结 12 1409
温柔的废话
温柔的废话 2020-12-02 20:26

I\'ve deployed Django to Apache via mod_wsgi. Django is running fine when hosted from Apache. However, I\'m trying to do some maintenance via manage.py

12条回答
  •  无人及你
    2020-12-02 21:17

    It seems the path to your project isn't being recognized by wsgi. This has happened to me, and to solve it I added this to the top of my .wsgi file:

    import os
    import sys
    
    root_path = os.path.abspath(os.path.split(__file__)[0])
    sys.path.insert(0, os.path.join(root_path, 'project_name'))
    sys.path.insert(0, root_path)
    

提交回复
热议问题