Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread ludovic coues
As long as you use similar hardware and the same OS version
everywhere, a zip should work. You might get some issue if each
machine have a different version of some lib on which python have
dependencies

2016-09-22 3:25 GMT+02:00 'Abraham Varricatt' via Django users
:
> Hello,
>
> Do we have any standard/recommended way to distribute the python virtualenv
> used in a django application across multiple servers?
>
> I'm able to write a provisioning script to do the following on a server,
>
> (for brevity, this is just a high-overview)
> * Clone the master branch of my django project
> * Download, compile and alt-install python 3.5 from sources
> * Create a virtualenv folder and configure my environment according to the
> requirements.txt of my django project
> * setup httpd conf files, restart server .. etc
>
> The OS I'm primarily targeting is centos7. For that matter, I'm doing my
> compiling on a centos7 box as well.
>
> My concern is that it feels wasteful to repeat the above steps on every
> system if I'm trying to scale across multiple machines. Is it possible to
> just provision the virtualenv on a single system, zip the folder and
> copy-paste to whichever systems I want to deploy to? Are there any concerns
> I need to be aware of, if I'm going by this approach?
>
> Confused about django provisioning options,
> Abraham V.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/31679960-a802-469c-aea9-6431ea765735%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZB%3DyPi82EZVKci3FNiZLe3qfcZLQwy9JuaOGgEbA_xrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Foreign key set template

2016-09-22 Thread jorrit787
I have a question about using *model.foreignkey_set* in Django templates. I 
was trying to use *model.foreignkey_set* to determine if there were any 
foreign keys for this model, but it appears that *model.foreignkey_set* 
returns something different than *model.foreignkey_set.all* - why is that? 
Shouldn't both return *None* if there are no foreign keys?

Just curious :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2121cdf4-9a32-4d0e-a107-03b5e9b3fd08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Someone can solve this error

2016-09-22 Thread shaoranzerolk
Traceback (most recent call last):
  File 
"/home/souma/Descargas/pycharm-2016.1.4/helpers/pycharm/django_manage.py", 
line 41, in 
run_module(manage_file, None, '__main__', True)
  File "/usr/lib64/python3.4/runpy.py", line 182, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.4/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/home/souma/PycharmProjects/untitled10/manage.py", line 10, in 

execute_from_command_line(sys.argv)
  File 
"/usr/lib64/python3.4/site-packages/django/core/management/__init__.py", 
line 353, in execute_from_command_line
utility.execute()
  File 
"/usr/lib64/python3.4/site-packages/django/core/management/__init__.py", 
line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib64/python3.4/site-packages/django/core/management/base.py", 
line 348, in run_from_argv
self.execute(*args, **cmd_options)
  File "/usr/lib64/python3.4/site-packages/django/core/management/base.py", 
line 398, in execute
self.check()
  File "/usr/lib64/python3.4/site-packages/django/core/management/base.py", 
line 426, in check
include_deployment_checks=include_deployment_checks,
  File "/usr/lib64/python3.4/site-packages/django/core/checks/registry.py", 
line 75, in run_checks
new_errors = check(app_configs=app_configs)
  File "/usr/lib64/python3.4/site-packages/django/core/checks/urls.py", 
line 13, in check_url_config
return check_resolver(resolver)
  File "/usr/lib64/python3.4/site-packages/django/core/checks/urls.py", 
line 23, in check_resolver
for pattern in resolver.url_patterns:
  File "/usr/lib64/python3.4/site-packages/django/utils/functional.py", 
line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib64/python3.4/site-packages/django/core/urlresolvers.py", 
line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File "/usr/lib64/python3.4/site-packages/django/utils/functional.py", 
line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib64/python3.4/site-packages/django/core/urlresolvers.py", 
line 410, in urlconf_module
return import_module(self.urlconf_name)
  File "/usr/lib64/python3.4/importlib/__init__.py", line 109, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2226, in 
_find_and_load_unlocked
  File "", line 1200, in _load_unlocked
  File "", line 1129, in _exec
  File "", line 1471, in exec_module
  File "", line 321, in 
_call_with_frames_removed
  File "/home/souma/PycharmProjects/untitled10/untitled10/urls.py", line 
21, in 
url(r'^',include('login.urls')),
  File "/usr/lib64/python3.4/site-packages/django/conf/urls/__init__.py", 
line 52, in include
urlconf_module = import_module(urlconf_module)
  File "/usr/lib64/python3.4/importlib/__init__.py", line 109, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2226, in 
_find_and_load_unlocked
  File "", line 1200, in _load_unlocked
  File "", line 1129, in _exec
  File "", line 1471, in exec_module
  File "", line 321, in 
_call_with_frames_removed
  File "/home/souma/PycharmProjects/untitled10/login/urls.py", line 3, in 

from login.views import vista, Registro
  File "/home/souma/PycharmProjects/untitled10/login/views.py", line 5, in 

from .forms import Usuario
  File "/home/souma/PycharmProjects/untitled10/login/forms.py", line 7, in 

class Usuario(forms.ModelForm):
  File "/usr/lib64/python3.4/site-packages/django/forms/models.py", line 
247, in __new__
opts.field_classes)
  File "/usr/lib64/python3.4/site-packages/django/forms/models.py", line 
172, in fields_for_model
formfield = f.formfield(**kwargs)
  File 
"/usr/lib64/python3.4/site-packages/django/db/models/fields/__init__.py", 
line 1711, in formfield
return super(EmailField, self).formfield(**defaults)
  File 
"/usr/lib64/python3.4/site-packages/django/db/models/fields/__init__.py", 
line 1120, in formfield
return super(CharField, self).formfield(**defaults)
  File 
"/usr/lib64/python3.4/site-packages/django/db/models/fields/__init__.py", 
line 903, in formfield
return form_class(**defaults)
  File "/usr/lib64/python3.4/site-packages/django/forms/fields.py", line 
229, in __init__
super(CharField, self).__init__(*args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/django/forms/fields.py", line 
118, in __init__
widget.attrs.update(extra_attrs)
AttributeError: 'EmailField' object has no attribute 'attrs'

django 1.9.7

-- 
You received this message because you are subs

Mock external api call (xero)

2016-09-22 Thread Karim
Hello everyone, I would like to test my code that call the xero api server
and to do that I want create mocked response to test different scenarios.

At the moment I want test just few endpoints, my Idea is to create a class
as a container of the items needed to render.

The items are generated by a class that use a "stamp" of the returned json
and add or modify the stamp using the given kwargs.

What you think about the example above? Maybe you have better idea?

e.g.

response = MockedXeroResponse()

invoice = fakeInvoice(**kwargs)  # kwargs add fields
another_invoice = fakeInvoice(**{'Amount':1000})

response.add(invoice, another_invoice)  #
response.json  # return the json response as the XERO api with the two
invoices.


​Thank you​

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGXGhbcAQhxB6aB06Ur92Dh%2BmQZQciQY2xGeCJsBe%2Bcnfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread Vadim Serdiuk
Hi. I suggest you to look at Docker.

четверг, 22 сентября 2016 г., 4:25:48 UTC+3 пользователь Abraham Varricatt 
написал:
>
> Hello,
>
> Do we have any standard/recommended way to distribute the python 
> virtualenv used in a django application across multiple servers?
>
> I'm able to write a provisioning script to do the following on a server,
>
> (for brevity, this is just a high-overview)
> * Clone the master branch of my django project
> * Download, compile and alt-install python 3.5 from sources
> * Create a virtualenv folder and configure my environment according to the 
> requirements.txt of my django project
> * setup httpd conf files, restart server .. etc
>
> The OS I'm primarily targeting is centos7. For that matter, I'm doing my 
> compiling on a centos7 box as well. 
>
> My concern is that it feels wasteful to repeat the above steps on every 
> system if I'm trying to scale across multiple machines. Is it possible to 
> just provision the virtualenv on a single system, zip the folder and 
> copy-paste to whichever systems I want to deploy to? Are there any concerns 
> I need to be aware of, if I'm going by this approach?
>
> Confused about django provisioning options,
> Abraham V.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ee51bc11-9540-4bfb-bbea-d5789c1cb305%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread Saeon Tao
i just been learning about openstack... which i think uses a lot of 
docker... the idea is to make all apps independent of OS

On Thursday, September 22, 2016 at 3:25:48 AM UTC+2, Abraham Varricatt 
wrote:
>
> Hello,
>
> Do we have any standard/recommended way to distribute the python 
> virtualenv used in a django application across multiple servers?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b6363bb-f34e-4470-bfc1-548c27ac3ca4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key set template

2016-09-22 Thread Tim Graham
model.foreignkey_set returns a manager while model.foreignkey_set.all 
returns a QuerySet.

https://docs.djangoproject.com/en/stable/topics/db/queries/#following-relationships-backward

On Thursday, September 22, 2016 at 7:09:27 AM UTC-4, jorr...@gmail.com 
wrote:
>
> I have a question about using *model.foreignkey_set* in Django templates. 
> I was trying to use *model.foreignkey_set* to determine if there were any 
> foreign keys for this model, but it appears that *model.foreignkey_set* 
> returns something different than *model.foreignkey_set.all* - why is 
> that? Shouldn't both return *None* if there are no foreign keys?
>
> Just curious :)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/edd80794-cae1-45fb-9ea9-da3cdf124192%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to save images present in Django application directory to models

2016-09-22 Thread Krishn Bera
I am making a Django application that will do some sort of image 
manipulation. As an intermediate step, I am generating new images in the 
Django application directory. Now I want to save these images(.jpg) to a 
model that contains ImageField. How should I go about saving this image in 
database? Do we have any Django functionality that can upload images 
'programatically' to a database?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d24076d-9c95-4b93-9c8a-58171ad932a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread Ricardo Daniel Quiroga
create a docker image alternative?

2016-09-22 11:20 GMT-03:00 Saeon Tao :

> i just been learning about openstack... which i think uses a lot of
> docker... the idea is to make all apps independent of OS
>
> On Thursday, September 22, 2016 at 3:25:48 AM UTC+2, Abraham Varricatt
> wrote:
>>
>> Hello,
>>
>> Do we have any standard/recommended way to distribute the python
>> virtualenv used in a django application across multiple servers?
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/3b6363bb-f34e-4470-bfc1-548c27ac3ca4%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Ricardo Daniel Quiroga

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO2-wHYhTKCHd%2BoimbSBVKTgETXiKm_aszbV4-OD3pq0kiVuFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Package a virtualenv to deploy across multiple systems?

2016-09-22 Thread Vadym Serdiuk
=the idea is to make all apps independent of OS=
Yeah! Docker do this. And any more... Docker can launch all parts of
application in independent containers. And you can make independent
scenarios and even load different libraries for different parts of
application. And with docker-composer you can make single scenario for all
containers and launch all of them with one command. And with docker-swarm
you can create scalable system.

2016-09-22 17:20 GMT+03:00 Saeon Tao :

> i just been learning about openstack... which i think uses a lot of
> docker... the idea is to make all apps independent of OS
>
> On Thursday, September 22, 2016 at 3:25:48 AM UTC+2, Abraham Varricatt
> wrote:
>>
>> Hello,
>>
>> Do we have any standard/recommended way to distribute the python
>> virtualenv used in a django application across multiple servers?
>>
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/Nw8MTxqhWMQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/3b6363bb-f34e-4470-bfc1-548c27ac3ca4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
С уважением, Сердюк Вадим.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGkBLG%2BBo0J3fjfsGgK1dDzn7xC4Z3J%2Bu%2Bdg_-qMz5zxiOBEVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.