我在我的ansible剧本中有这个剧本
- name: Setup virtualenv
pip:
requirements="/vagrant/webapp/requirements/{{ requirements_filename }}"
virtualenv="$HOME/.envs/{{ project_name }}"
Run Code Online (Sandbox Code Playgroud)
但是,我收到一个Permission denied错误.似乎ansible试图将软件包安装到系统路径而不是virtualenv.
这是完整的追溯:
TASK: [deploy | Setup virtualenv] *********************************************
failed: [default] => {"cmd": "/usr/bin/pip install -r /vagrant/webapp/requirements/dev.txt", "failed": true}
msg: stdout: New python executable in /home/vagrant/.envs/venv/bin/python
Installing setuptools, pip...done.
Downloading/unpacking django>=1.8 (from -r /vagrant/webapp/requirements/requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): wsgiref>=0.1.2 in /usr/lib/python2.7 (from -r /vagrant/webapp/requirements/requirements.txt (line 4))
Downloading/unpacking django-allauth>=0.19.1 (from -r /vagrant/webapp/requirements/requirements.txt (line 5))
Running setup.py (path:/tmp/pip_build_vagrant/django-allauth/setup.py) egg_info for package django-allauth
Downloading/unpacking psycopg2>=2.6 (from …Run Code Online (Sandbox Code Playgroud) 有两种型号,User和Friends.我想让两个用户结交朋友,但确实有用.
控制台刚才说,
django.core.management.base.CommandError:系统检查发现了一些问题:
错误::(admin.E202)'api4android.Friends'对'api4android.User'有多个ForeignKey.
这是代码
class Friends(models.Model):
user = models.ForeignKey(User, null=True, related_name='user')
friend = models.ForeignKey(User, null=True, related_name='friend')
note_name = models.CharField(max_length=20)
def __str__(self):
return self.note_name
Run Code Online (Sandbox Code Playgroud)
希望我可怜的英语让你理解我的意思.
我正在尝试做一个简单的查询,但我得到了 'Manager' object is not iterable error.
我的代码(相关部分):
def sort(request):
sort_type = request.GET.get('srt', '')
q = Question.objects
if sort_type == 'views':
q.order_by('-views')
q.all()
return render(request, 'questions/index.html',{
'questions': q
})
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我按照这里的指示:http: //django-oscar.readthedocs.org/en/latest/internals/getting_started.html
当我试图注册@ http://127.0.0.1:8000/accounts/login/时,我收到此错误:
环境:
Django版本:1.8.3 Python版本:2.7.9
Traceback:
File "/home/yw/oscar/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/yw/oscar/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
71. return self.dispatch(request, *args, **kwargs)
File "/home/yw/oscar/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
89. return handler(request, *args, **kwargs)
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/views.py" in post
124. return self.validate_registration_form()
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/views.py" in validate_registration_form
210. self.register_user(form)
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/mixins.py" in register_user
55. self.send_registration_email(user)
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/mixins.py" in send_registration_email
92. Dispatcher().dispatch_user_messages(user, messages)
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/utils.py" in dispatch_user_messages
56. self.send_user_email_messages(user, messages)
File "/home/yw/oscar/local/lib/python2.7/site-packages/oscar/apps/customer/utils.py" in send_user_email_messages
72. email = self.send_email_messages(user.email, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Shopify 的 python API 来检索产品图像列表,但出现错误。我认为这是因为网址格式错误。有解决这个问题的方法吗?
images = shopify.Image.find(product.id)
Run Code Online (Sandbox Code Playgroud)
错误堆栈跟踪:
Traceback:
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/core/handlers/base.py" in get_response
105. response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/mezzanine/pages/middleware.py" in process_view
45. return view_func(request, *view_args, **view_kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/views/generic/base.py" in view
48. return self.dispatch(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in _wrapper
25. return bound_func(*args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/contrib/auth/decorators.py" in _wrapped_view
20. return view_func(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in bound_func
21. return func(self, *args2, **kwargs2)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in _wrapper
25. return bound_func(*args, **kwargs)
File "/home/rodxavierbondoc/workspace/sg/djangoproject/shopify_app/decorators.py" in wrapper
10. return …Run Code Online (Sandbox Code Playgroud)