我以为我已经将我的项目正确地上传到了asmallorange的远程服务器/主机,但我一直遇到问题。
这就是我所做的: 按照此页面上的所有说明操作: https://help.asmallorange.com/index.php?/Knowledgebase/Article/View/305/0/install-django-using-virtualenv
检查了我的网站(angusrchen.com)并获得了默认"欢迎来到django!"页。好的,所以我知道django安装正确。
然后我使用filezilla将我的项目文件上传到我在远程服务器上创建项目的目录路径。
我跑了 $ python manage.py syncdb没有错误,那么
$ python manage.py collectstatic
没有错误。
两个问题: 当我访问我的网页时,Base.html正在加载,但是javascript似乎都没有工作。
现在我在尝试导航到任何django页面时遇到此错误(例如/ admin或/ blog)
错误如下:
OperationalError at /blog/
no such table: django_site
Request Method: GET
Request URL: http://angusrchen.com/blog/
Django Version: 1.6.5
Exception Type: OperationalError
Exception Value: no such table: django_site
Exception Location: /home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 451
Python Executable: /home/angusrch/.env/env/bin/python
Python Version: 2.7.6
Python Path: ['/home/angusrch/.env/env/lib/python2.7/site-packages',
'/home/angusrch/public_html',
'/home/angusrch/.env/env/lib/python27.zip',
'/home/angusrch/.env/env/lib/python2.7',
'/home/angusrch/.env/env/lib/python2.7/plat-linux2',
'/home/angusrch/.env/env/lib/python2.7/lib-tk',
'/home/angusrch/.env/env/lib/python2.7/lib-old',
'/home/angusrch/.env/env/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk']
Server time: Sat, 2 Aug 2014 11:18:06 -0500
Environment:
Request Method: GET
Request URL: http://angusrchen.com/blog/
Django Version: 1.6.5
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.comments',
'django.contrib.sites',
'tagging',
'mptt',
'blog',
'zinnia')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get
333. self.date_list, self.object_list, extra_context = self.get_dated_items()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get_dated_items
414. qs = self.get_dated_queryset(ordering='-%s' % self.get_date_field())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get_dated_queryset
350. qs = self.get_queryset().filter(**lookup)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/views/mixins/prefetch_related.py" in get_queryset
25. return super(PrefetchRelatedMixin, self
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/views/mixins/callable_queryset.py" in get_queryset
20. return self.queryset()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/manager.py" in all
133. return self.get_queryset()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/managers.py" in get_queryset
46. super(EntryPublishedManager, self).get_queryset())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/managers.py" in entries_published
33. status=PUBLISHED, sites=Site.objects.get_current())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/contrib/sites/models.py" in get_current
47. current_site = self.get(pk=sid)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/manager.py" in get
151. return self.get_queryset().get(*args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in get
304. num = len(clone)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in __len__
77. self._fetch_all()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
857. self._result_cache = list(self.iterator())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in iterator
220. for row in compiler.results_iter():
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
713. for rows in self.execute_sql(MULTI):
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
786. cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
69. return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
53. return self.cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/utils.py" in __exit__
99. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
53. return self.cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
451. return Database.Cursor.execute(self, query, params)
Exception Type: OperationalError at /blog/
Exception Value: no such table: django_site
答案 0 :(得分:2)
您的错误只是说明您的数据库不包含表django_site。
尝试检查数据库(查看该表是否确实存在),检查您是否正在访问设置中的好数据库(如果您的服务器上有多个数据库)。
还要确保一切都在开发环境中工作,如果是这样,您可以将数据库从开发环境复制到服务器,或者删除服务器上的数据库并再次运行syncdb
。
PS:如果您无法访问数据库,我认为您会收到另一个错误,但检查您的文件权限,可能也会导致此问题。