beginner django setup: Could not import settings 'myproject.settings'
I am trying to install django on ubuntu. I am walking through the following setup tutorial: http://jeffbaier.com/articles/installing-django-on-an-ubuntu-linux-server/
I am getting an error when I try to do the 'syncdb' step. It seems like an environment problem. How do I fix this?
me@ubuntu:~/django_projects/myproject$ django-admin.py syncdb
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 433, in execute_from_command_line
utility.execute()
...
File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 92, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %开发者_如何学JAVAs" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named myproject.settings
me@ubuntu:~/django_projects/myproject$
No, this is a problem with that tutorial. You should run manage.py syncdb
.
or
django-admin.py syncdb --settings=myproject.settings
./manage.py is just a thin wrapper that every new django project is set up with to configure the path to that particular projects settings.py file.
精彩评论