我正在尝试使用python 3将Django网站部署到Amazon Web Services。现在,django-storage与python3不兼容,所以我安装了兼容的django-storages-redux。但是,当我试图:
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 :(得分:1)
我也遇到了这个问题。我能够通过开始一个新环境并重新安装包来解决。我相信我有两个打包“存储”名称的包。
这是使用Python 3.4,Django 1.7.1和django-storages-redux 1.2.3。
答案 1 :(得分:0)
你是想冻结/你的脚本被冻结了吗?比如用cx_Freeze。 Cx_freeze,据我所知,其他冷冻程序与.egg文件不能很好地配合。您可能需要手动将第三方api的文件夹放在/ python34 / Lib / site-packages中。
答案 2 :(得分:0)
我实际上以不同的方式解决了我的问题...我将其添加到我的requirements.txt文件中:
pages
现在它正在工作!有一个不同的图书馆,但仍然......