Django/Python EnvironmentError?

后端 未结 3 2087
说谎
说谎 2021-01-03 14:02

I am getting an error when I try to use syncdb:

python manage.py syncdb

Error message:

File \"/usr/local/lib/p         


        
相关标签:
3条回答
  • 2021-01-03 14:44

    Another thing that gives this error is permissions - very hard to track down.

    Solution for me was to move <myproject> to /var/www/<myproject> and do chown -R root:root /var/www/<myproject>

    0 讨论(0)
  • 2021-01-03 14:52

    Your trace states:

    Import by filename is not supported.
    

    Which might indicate that you try to import (or maybe set the DJANGO_SETTINGS_MODULE) to the full python filename, where it should be a module path: your.module.settings

    You could also try to specify your DJANGO_SETTINGS_MODULE directly from command line, like:

    $ DJANGO_SETTINGS_MODULE=your.module.settings ./manage.py syncdb
    
    0 讨论(0)
  • Make sure your settings.py file is in the same directory as manage.py (you will also have to run manage.py from this directory, i.e. ./manage.py syncdb), or make the environment variable DJANGO_SETTINGS_MODULE point to it.

    0 讨论(0)
提交回复
热议问题