Django 1.7不再找到应用程序,为什么?

时间:2014-09-24 09:15:29

标签: python django

自从尝试使用Django 1.7和Python 3后,我发现我的应用程序甚至安装了软件包时遇到了真正的困难:

> virtualenv -p python3 env
> source env/bin/activate
> pip3 install oauth2_provider

然后我设置了oauth2_provider,因为我已经使用Django 1.6和Python 2.7做了很多次,但在Django 1.7和Python 3中我得到了这个错误......

 File "/Users/user/Documents/workspace/test/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Users/user/Documents/workspace/test/test/core/urls.py", line 9, in <module>
    url(r'^api/', include('oauth2_provider.urls', namespace='oauth2_provider')),
  File "/Users/user/Documents/workspace/test/env/lib/python3.4/site-packages/django/conf/urls/__init__.py", line 28, in include
    urlconf_module = import_module(urlconf_module)
  File "/Users/user/Documents/workspace/test/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'oauth2_provider.urls'

网址:

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',


    url(r'^admin/', include(admin.site.urls)),

    url(r'^api/', include('oauth2_provider.urls', namespace='oauth2_provider')),

)

我已经检查了/env/libs/python3.4/site-packages/oauth2_provider,而且__init__.py就是这样吗?我已经尝试重新安装,甚至重新启动,但没有快乐!有什么想法吗?

我还有另一个问题是开放的,它是相同的应用程序,也许是相关的: https://stackoverflow.com/questions/25998841/lookuperror-app-profiles-doesnt-have-a-model

这是Django 1.7,Python 3吗?所有这些都是我第一次使用这些版本。

1 个答案:

答案 0 :(得分:3)

oauth2_provider包似乎与Python 3不兼容。