Django Shell No module named settings

后端 未结 12 1410
温柔的废话
温柔的废话 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 21:19

    Since your web app is working, check that you're running manage.py with the same python interpreter that's defined in your .wsgi file (and if you append other directories to sys.path in your .wsgi file, make sure they're in the pythonpath here too).

    If you try to import something in your settings file that throws an ImportError, Django tells you settings cannot be imported. Newer versions of django will mention (If the file settings.py does indeed exist, it's causing an ImportError somehow.) and I've run into this a few times.

    If it's not that, maybe try using django-admin.py instead, just in case something has gone wrong in your manage.py file. AFAIK there is no good reason to modify manage.py directly.

提交回复
热议问题