我正在apache服务器上设置一个django项目。使用manage.py runsslserver
在我的电脑上运行正常。
当我加载到apache服务器时,我可以运行manage.py migrate
和collectstatic
以及许多安装程序。
但是当我尝试进入网页时,我收到错误消息“未找到数据文件,数据文件生成失败”,并带有此回溯:
Environment:
Request Method: GET
Request URL: https://ekim.hexiawebservices.co.uk/
Django Version: 1.11.5
Python Version: 2.7.12
Installed Applications:
['django.contrib.admin',
'registration',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'djangosecure',
'sslserver',
'ekim']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'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 "/var/www/ekim/env/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
172. resolver_match = resolver.resolve(request.path_info)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in resolve
362. for pattern in self.url_patterns:
File "/var/www/ekim/env/lib/python2.7/site-packages/django/utils/functional.py" in __get__
35. res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in url_patterns
405. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/utils/functional.py" in __get__
35. res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/ekim/env/lib/python2.7/site-packages/django/urls/resolvers.py" in urlconf_module
398. return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/var/www/ekim/ekim/urls.py" in <module>
30. url(r'^accounts/', include('registration.backends.hmac.urls')),
File "/var/www/ekim/env/lib/python2.7/site-packages/django/conf/urls/__init__.py" in include
50. urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/backends/hmac/urls.py" in <module>
10. from . import views
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/backends/hmac/views.py" in <module>
15. from registration.views import ActivationView as BaseActivationView
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/views.py" in <module>
12. from registration.forms import RegistrationForm
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/forms.py" in <module>
19. from . import validators
File "/var/www/ekim/env/lib/python2.7/site-packages/registration/validators.py" in <module>
10. from confusable_homoglyphs import confusables
File "/var/www/ekim/env/lib/python2.7/site-packages/confusable_homoglyphs/confusables.py" in <module>
7. from .categories import unique_aliases, alias
File "/var/www/ekim/env/lib/python2.7/site-packages/confusable_homoglyphs/categories.py" in <module>
147. raise Exception('Datafile not found, datafile generation failed!')
Exception Type: Exception at /
Exception Value: Datafile not found, datafile generation failed!
我一直试图对此进行3小时的排序,但无法解决。非常感谢任何帮助。
答案 0 :(得分:2)
我遇到了同样的问题,经过一些研究后我发现了问题的根源:registration
库需要confusable-homoglyphs
,confusable-homoglyphs
查找两个文件:{ {1}}和categories.json
。如果找不到这些文件,则tries to download来自 unicode.org - confusables.txt
和Scripts.txt
的两个文件 - 并从中生成两个json文件。如果您经常下载这些文件, unicode.org 将限制您的带宽,甚至可能将您的地址列入黑名单。
confusables.txt
很难将文件放在confusable-homoglyphs
返回的工作目录中,因此我将这些文件下载到另一台计算机上并将它们放在我的工作目录中。 Django迁移成功了。我希望这也适合你!
答案 1 :(得分:2)
(我无法对这个问题发表评论,因为我没有足够的业力。)
您遇到此错误,因为您依赖我编写的库。它会在第一次加载时从unicode.org
下载一些文件。不幸的是,我没想到会有一些用例,例如使用我的lib部署应用程序作为依赖于平台即服务的应用程序,其中依赖项经常被下载,这也会导致我的lib更频繁地点击unicode.org
比我想象的还要好。
幸运的是有人向lib提交了一个补丁,解决了这个问题。请升级到confusable_homoglyphs>=3.0.0
。 :)