0
我已經下載了django-activity-streams項目。Django:使用Django活動流的網址
所以我這樣做: pip install django-activity-stream
在那之後,我在我的項目設置的應用程序「actstream」(/ Django的活動流/ actstream)的位置(同一位置比我manage.py)
但是,當我的活動網址添加到我的URL配置是這樣的:
import django
import actstream
from django.contrib.auth.views import login
from django.contrib import auth
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView, ListView
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from actstream.views import *
urlpatterns = [,
url(r'^admin/', include(admin.site.urls)),
url(r'^accueil',accueil,name="accueil"),
url(r'^activity/$', include('actstream.urls')),
]
我有這樣的錯誤在我的終端:
Unhandled exception in thread started by <function wrapper at 0x7f6c6abdc230>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/bouslim/Projets/projup/projup/urls.py", line 72, in <module>
url(r'^activity/$', include('actstream.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/bouslim/Projets/projup/actstream/urls.py", line 7, in <module>
from actstream import feeds, views
File "/home/bouslim/Projets/projup/actstream/feeds.py", line 9, in <module>
from django.contrib.sites.models import Site
File "/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py", line 83, in <module>
class Site(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 103, in __new__
"application was loaded. " % (module, name))
RuntimeError: Model class django.contrib.sites.models.Site doesn't
declare an explicit app_label and either isn't in an application in
INSTALLED_APPS or else was imported before its application was loaded.
啊完美,它的作品!非常非常感謝你 !我看到「django.contrib.sites」的警告,但我有一個比1.7更新的Django版本(我有Django 1.9) – Zoulou