简体   繁体   English

django runserver找不到django

[英]django runserver can't find django

I'm creating a Django application and I've compiled my own Python then used buildout to manage my dependencies. 我正在创建Django应用程序,并且已经编译了自己的Python,然后使用buildout管理我的依赖项。

I'm at the point where I want to run manage.py runserver but I can get an ImportError for django 我到了要运行manage.py runserver的地步,但是我可以得到django的ImportError

Digging a little deeper it appears that actually it can find django - if I just run manage.py it lists all available commands (so obviously it imported django), but it appears that manage.py runserver calls manage.py again, and I guess this must be calling Python without the overloaded path that buildout provides. 深入研究似乎可以找到django-如果我只运行manage.py,它列出了所有可用的命令(显然,它导入了django),但是似乎manage.py runserver再次调用了manage.py,我猜这必须在没有构建提供的重载路径的情况下调用Python。

So, how can I get manage.py runserver to work with my given setup? 因此,如何使manage.py runserver与给定的设置一起使用? Other tutorials I see all say to use virtualenv but I've gone down the path of compiling my own Python so I'd like to stick with that. 我看到的其他教程都说要使用virtualenv,但是我走了编译自己的Python的道路,所以我想坚持下去。 I've also seen similar questions but they seem to assume the use of system Python, which I am not using. 我也看到过类似的问题,但是它们似乎假定使用系统Python,而我没有使用。 Possibly Django should be installed into my compiled Python but I thought the point of buildout was to avoid the need to do that. 可能应该将Django安装到我编译的Python中,但我认为构建的重点是避免这样做。

So, I think I figured it out. 所以,我想我已经知道了。 I found a file called django-admin.py in my buildout's bin directory, which eventually led me to add a django section to my buildout.cfg (see https://pypi.python.org/pypi/djangorecipe for details). 我在构建的bin目录中找到了一个名为django-admin.py的文件,该文件最终导致我向buildout.cfg中添加了django部分(有关详细信息,请参见https://pypi.python.org/pypi/djangorecipe )。

This created a file called django in my buildout's bin directory, and now running bin/django runserver allows me to view my site locally. 这在我的构建的bin目录中创建了一个名为django的文件,现在运行bin / django runserver允许我在本地查看我的站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM