2015-07-09 3 views
0

Я пытаюсь развернуть сайт Django для веб-служб Amazon с помощью python 3. Теперь django-хранилища не совместимы с python3, поэтому я установил django-storageages- redux, который совместим. Но, когда я пытаюсь:Django-storageages-redux: невозможно импортировать имя 'setting'

python3 manage.py runserver 

Я получаю это:

Traceback (most recent call last): 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 132, in get_response 
    response = wrapped_callback(request, *callback_args, **callback_kwargs) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/jokes/views.py", line 6, in home_page 
    response = render(request, 'home.html') 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/shortcuts.py", line 67, in render 
    template_name, context, request=request, using=using) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/loader.py", line 99, in render_to_string 
    return template.render(context, request) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/backends/django.py", line 74, in render 
    return self.template.render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/base.py", line 209, in render 
    return self._render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/base.py", line 201, in _render 
    return self.nodelist.render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/base.py", line 903, in render 
    bit = self.render_node(node, context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/debug.py", line 79, in render_node 
    return node.render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/loader_tags.py", line 135, in render 
    return compiled_parent._render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/base.py", line 201, in _render 
    return self.nodelist.render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/base.py", line 903, in render 
    bit = self.render_node(node, context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/template/debug.py", line 79, in render_node 
    return node.render(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/templatetags/static.py", line 105, in render 
    url = self.url(context) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 16, in url 
    return static(path) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 9, in static 
    return staticfiles_storage.url(path) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/utils/functional.py", line 226, in inner 
    self._setup() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 394, in _setup 
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/files/storage.py", line 329, in get_storage_class 
    return import_string(import_path or settings.DEFAULT_FILE_STORAGE) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/utils/module_loading.py", line 26, in import_string 
    module = import_module(module_path) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/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 2231, in _gcd_import 
    File "<frozen importlib._bootstrap>", line 2214, in _find_and_load 
    File "<frozen importlib._bootstrap>", line 2203, 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 1448, in exec_module 
    File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/storages/backends/s3boto.py", line 24, in <module> 
    from storages.utils import setting 
ImportError: cannot import name 'setting' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run 
    self.result = application(self.environ, self.start_response) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__ 
    return self.application(environ, start_response) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 189, in __call__ 
    response = self.get_response(request) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 218, in get_response 
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 261, in handle_uncaught_exception 
    return debug.technical_500_response(request, *exc_info) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 97, in technical_500_response 
    html = reporter.get_traceback_html() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 383, in get_traceback_html 
    c = Context(self.get_traceback_data(), use_l10n=False) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 328, in get_traceback_data 
    frames = self.get_traceback_frames() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 501, in get_traceback_frames 
    'vars': self.filter.get_traceback_frame_variables(self.request, tb.tb_frame), 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 234, in get_traceback_frame_variables 
    cleansed[name] = self.cleanse_special_types(request, value) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/views/debug.py", line 189, in cleanse_special_types 
    if isinstance(value, HttpRequest): 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/utils/functional.py", line 226, in inner 
    self._setup() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 394, in _setup 
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/core/files/storage.py", line 329, in get_storage_class 
    return import_string(import_path or settings.DEFAULT_FILE_STORAGE) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/django/utils/module_loading.py", line 26, in import_string 
    module = import_module(module_path) 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/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 2231, in _gcd_import 
    File "<frozen importlib._bootstrap>", line 2214, in _find_and_load 
    File "<frozen importlib._bootstrap>", line 2203, 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 1448, in exec_module 
    File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 
    File "/home/antoni4040/Documents/django-trunk/django/bin/thermostatis/env/lib/python3.4/site-packages/storages/backends/s3boto.py", line 24, in <module> 
    from storages.utils import setting 
ImportError: cannot import name 'setting' 

Странно, что что установка файла, который он пытается импортировать? Кто-нибудь преуспел в таком развертывании?

ответ

0

Я на самом деле решить мою проблему по-другому ... Я добавил это в мой файл requirements.txt:

-e git+https://github.com/coagulant/[email protected]#egg=django_storages-origin-py3 

и теперь он работает! С другой библиотекой, но все же ...

0

Вы пытаетесь заморозить/заблокирован ваш сценарий? Например, cx_Freeze. Cx_freeze, и насколько я знаю, другие программы замораживания не играют хорошо с .egg-файлами. Возможно, вам придется вручную поместить стороннюю папку api в пакеты/python34/Lib/site-packages.

1

Я столкнулся с этой проблемой. Я смог разрешить , начиная новую среду и переустановив пакет. Я считаю, что у меня было два пакета, сражающихся за имя «хранилища».

Это было с Python 3.4, Django 1.7.1 и django-storages-redux 1.2.3.

Смежные вопросы