不知道如何继续这个项目。花了好几个小时寻找答案。
ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named oscar
我用 djangohosting.ch 想安装 django-oscar 我对 django 不是很熟悉
我打算创建 virtualenv /v/ 并在我的一个项目中启动并运行 django-oscar。让我们称之为 myproject
我开始使用 djangohosting.ch 的 1-click 安装程序创建 myproject,现在它已安装在 /home/myuser/myproject
我想我在 dir /v/ 中正确安装了 virtualenv,并且我使用了 pip install django-oscar ,我认为这一切都很好。我在 /v/lib/python2.6/site-packages 中看到一堆目录
但我不确定我是否正确设置了 PYTHONPATH。我将 /myproject/RUN 文件配置为
PYTHONPATH=/home/myuser/v/lib/python2.6/site-packages:/home/myuser/v/lib/python2.6/site-packages/django:/home/myuser/v/lib/python2.6/site-packages/oscar:/home/myuser/myproject:/home/myuser/myproject/myproject:. python manage.py runserver 127.0.0.1:62202
我按照本指南中的 settings.py 设置
编辑 /myproject/myproject/settings.py
我根据指南编辑了 urls.py。
我编辑了 /home/myuser/init/myproject 文件这些行
PYTHONPATH="$HOME/v/lib"
DAEMON=$HOME/v/bin/python
老实说,我还没有知道我在做什么。我希望我能更多地了解这一切。
感谢你们对我的帮助
这是我得到的:
michaelh@s10:~$ cd myproject
michaelh@s10:~/myproject$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 8, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/usr/lib/pymodules/python2.6/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 184, in inner
self._setup()
File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/lib/pymodules/python2.6/django/conf/__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named oscar