I'm using Django 1.4 and have the lay-out as recommended.
我使用的是Django 1.4,并按照建议进行了布局。
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
wsgi.py
myapp/
__init__.py
models.py
admin.py
views.py
This is the error i get when i run syncdb
这是运行syncdb时得到的错误
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings
I'll have set os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
in wsgy and in manage files
我要设置os.environ。在wsgy和manage files中设置默认值(“DJANGO_SETTINGS_MODULE”,“mysite.settings”)
I'm using Visual Studio 2013 with PyTools
我在使用PyTools的Visual Studio 2013
1 个解决方案
#1
1
For that to work you need to define your PYTHONPATH first.
要实现这一点,首先需要定义PYTHONPATH。
Here's something to read: http://www.stereoplex.com/blog/understanding-imports-and-pythonpath and http://www.tutorialspoint.com/python/python_modules.htm, but I'm sure you can google it!
这里有一些东西值得一读:http://www.stereoplex.com/blog/understand - important -and-pythonpath和http://www.tutorialspoint.com/python/python_modules.htm,但是我相信您可以谷歌!
- For Windows 7, you need to go to your Computer icon, right-click, choose Properties;
- 对于Windows 7,你需要打开电脑图标,右键单击,选择Properties;
- Pick "Advanced system settings";
- 选择“高级系统设置”;
- In the "Advanced" Tab, click the "Environment Variables";
- 在“高级”选项卡中,单击“环境变量”;
- Create a new "System variable";
- 创建一个新的“系统变量”;
- Name it PYTHONPATH ... put a value like "c:\projects;c\projects\mysite";
- 名字PYTHONPATH环境…例如“c:\项目;c\项目”;
- You can test it by opening a command prompt window and type in "echo %PYTHONPATH%";
- 您可以通过打开命令提示窗口并输入“echo %PYTHONPATH%”来测试它;
If you're not familiar with what I've described above, you need to read more.
如果你不熟悉我上面描述的内容,你需要多读一些。
#1
1
For that to work you need to define your PYTHONPATH first.
要实现这一点,首先需要定义PYTHONPATH。
Here's something to read: http://www.stereoplex.com/blog/understanding-imports-and-pythonpath and http://www.tutorialspoint.com/python/python_modules.htm, but I'm sure you can google it!
这里有一些东西值得一读:http://www.stereoplex.com/blog/understand - important -and-pythonpath和http://www.tutorialspoint.com/python/python_modules.htm,但是我相信您可以谷歌!
- For Windows 7, you need to go to your Computer icon, right-click, choose Properties;
- 对于Windows 7,你需要打开电脑图标,右键单击,选择Properties;
- Pick "Advanced system settings";
- 选择“高级系统设置”;
- In the "Advanced" Tab, click the "Environment Variables";
- 在“高级”选项卡中,单击“环境变量”;
- Create a new "System variable";
- 创建一个新的“系统变量”;
- Name it PYTHONPATH ... put a value like "c:\projects;c\projects\mysite";
- 名字PYTHONPATH环境…例如“c:\项目;c\项目”;
- You can test it by opening a command prompt window and type in "echo %PYTHONPATH%";
- 您可以通过打开命令提示窗口并输入“echo %PYTHONPATH%”来测试它;
If you're not familiar with what I've described above, you need to read more.
如果你不熟悉我上面描述的内容,你需要多读一些。