How do I stop getting ImportError: Could not import settings 'mofin.settings' when using django with wsgi?

前端 未结 15 1991
渐次进展
渐次进展 2020-12-04 11:15

I can\'t get wsgi to import my settings file for my project \'mofin\'.

The list of errors from the apache error log are as follows

mod_wsgi (pid=4001         


        
15条回答
  •  猫巷女王i
    2020-12-04 11:47

    This can also happen if you have an application (subdirectory to the project with an init file in it) named the same thing as the project. Your settings.py file may be in your project folder, but it seems that a part of the django system looks first for a module inside the project by the same name as the project and when it can't find a settings.py in there, it fails with a misleading message.

    -uniquename1
    
    ---settings.py
    
    ---manage.py
    
    ---application1
    
    -----file.py
    
    -----file2.py
    
    ---uniquename1  (problem, rename this to some other unique name)
    
    -----file.py
    
    -----file2.py
    

    Just something else to check for anyone else having this problem. Applies to Django 1.3 and probably others.

提交回复
热议问题