Re: I have issue. I want to migrate database from sqlite3 to postgresql. With a table have 10M records. I need a solution for issue. Maybe help me?

2020-03-26 Thread Daniel Chimeno
One possible solution:

$ createdb newdb
$ pgloader ./test/sqlite/sqlite.db postgresql:///newdb

https://github.com/dimitri/pgloader



El miércoles, 25 de marzo de 2020, 17:45:54 (UTC+1), Thắng IT escribió:
>
> solution

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3435d5bf-0422-4be0-afd5-e61b13460ea1%40googlegroups.com.


Re: External SSO for Django

2019-12-23 Thread Daniel Chimeno
Also interested

El lunes, 23 de diciembre de 2019, 4:14:21 (UTC+1), Malik Brahimi escribió:
>
> Just had a question about integrating external auth with my React/Django 
> application. I'm using a provisioned client instance from my company so 
> it's not Google, Facebook, or all the other social auth backends that exist 
> as django packages. I'd like to be able to SSO authenticate Django user 
> objects via OAuth or SAML in order to use permissions. Some client 
> libraries don't login Django users because they can simply use the external 
> API on the frontend. Others have no native support for a provider outside 
> the scope of popular social networks. 
>
> I suppose I could just create an api endpoint as a OAuth callback taking 
> the code from the query string, sending a request to exchange the code for 
> a token, decode the token for the userinfo, use the userinfo to either get 
> or create a user, and then login a user. But this is pretty painstaking 
> process. And I'm not sure about the security implications. Is there 
> anything you would suggest? I'm open to using SAML but again I have no idea 
> where to start with Django.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cbc00d32-3fc6-4094-aeec-f23e77cc5505%40googlegroups.com.


Re: Django DEBUG magic, and a bizarre bug under django-extra-views

2019-12-07 Thread Daniel Chimeno
+1 to more document about DEBUG magic.


El sábado, 7 de diciembre de 2019, 0:08:41 (UTC+1), Alaina Rowe escribió:
>
> I have not been able to reproduce the bug I am about to describe when 
> DEBUG is True, whether in production on Apache or locally on the Django dev 
> server. So my first question is: What is all the magic that Django DEBUG 
> does behind the scenes? The documentation doesn't have very much 
> information about this.
>
> Now for the bug. I understand that the following description is too 
> bare-bones for anyone to reproduce, but I have IP to protect, and I don't 
> have much hope of the error being reproduced anyway.
>
> Suppose I have a Django project with at least two apps, app alice with 
> model A and app bob with model B.
>
> I am using UpdateWithInlinesView from django-extra-views. The error occurs 
> when this view constructs a formset from instances of model A. In my email 
> about the 500, I get a message like this:
>
> FieldError at /some/url/
> Cannot resolve keyword 'field_of_A' into field. Choices are: field_of_B_1, 
> field_of_B_2, field_of_B_3
>
> I've gotten this type of error before. It normally happens when you tell a 
> form "I'm using model C" and "I'm using a field called debbie" and model C 
> doesn't have a field called debbie. That part makes sense. But this error 
> makes it look like it's checking against the field names of model B when it 
> should be checking model A. I have been racking my brain trying to figure 
> out how in the world the construction of a form from one model would 
> consult a different model from a different app.
>
> Furthermore, this doesn't happen most of the time, it goes away on server 
> restart, and it doesn't happen under DEBUG = True. So I'm wondering if it's 
> an app registry issue, some sort of race condition that gets the registry 
> out of whack. If so, then I might get somewhere by either understanding the 
> app registry better or understanding what DEBUG does.
>
> Any thoughts?
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fb61e2e6-001b-407c-b966-a3c1dc203a59%40googlegroups.com.


Re: Public Django administrative database

2018-05-24 Thread Daniel Chimeno
Thanks all for your answer, the OS-Open seems to work well.

-- 
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/a7923db2-8d1e-4b08-91d8-dad7b1fafadf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Public Django administrative database

2018-05-18 Thread Daniel Chimeno
Hi community!

I'm involved in a project heavily related to administrative geographic 
entities in UK.
(postal_sectors, postal areas, etc..)
Although at the moment is only for UK, could be expanded to other countries.
At first, I look 
into https://github.com/django/django-localflavor/tree/master/localflavor/gb
but there aren't so many entities there.

Then, searched in Google for some hours and couldn't find any reliable 
database or csv.

How you folks get this kind of information? Any resource?
If it's Django related would be awesome, if not, I could process it.

Thanks!

-- 
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/4bbc9772-01e2-43f1-bb5a-4a8dafa30f2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and asynchronous tasks

2016-11-10 Thread Daniel Chimeno
Hello,
One simple approach is to persist the calculations in the database, then 
you can use a view to display them in another page.

Hope it helps.

El jueves, 10 de noviembre de 2016, 9:05:29 (UTC+1), Alain Muls escribió:
>
> Hi All 
>
> I am building a website which makes calculations about the visibility of 
> satellites. These calculations take about half a minute so I do not want 
> to block the site during this time. I found django-rq and was able to 
> start a asynchronous task which handles the calculations. 
>
> The problem I have is how do I find out when the calculations of the 
> task thread are done so that I can direct the results to another web 
> page which will display them? 
>
> Thanks for your help 
>
> Alain Muls 
>
>
>

-- 
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/89fe0f4d-a39c-4a67-8667-261dbb87502c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django support new released Plesk Onyx

2016-10-27 Thread Daniel Chimeno
Hello,
Just wanted to share my thoughts here.
Plesk (a major web control panel solution) has recently launched its new 
version 12.5 (Onyx).

They finally support other programming languages and frameworks, before 
this they only support PHP.
The marketing website (https://www.plesk.com/onyx/) features Ruby and Node, 
I think we have lost an opportunity to promote our loved Django.

I know Django is more suited to medium-big customized (app)websites, where 
there is often direct support from sysadmins, but having 
direct support in Plesk would imply more users to Django and, therefore, 
his community.

Regards,


-- 
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/6684a8bc-4d62-412c-ac16-ce70fcdd5269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No Downtime Code Releases

2016-04-20 Thread Daniel Chimeno
This can help you.
https://medium.com/@healthchecks/deploying-a-django-app-with-no-downtime-f4e02738ab06#.dmyf7lk8y

El martes, 19 de abril de 2016, 3:37:19 (UTC+2), bliy...@rentlytics.com 
escribió:
>
> Hey,
>
> I have two issues I'm looking at solving at work, and I'm looking for a 
> couple suggestions as to how other people have solved this.  The two things 
> are:
>
> * scale out their django installation to allow for smaller releases (I'm 
> thinking microservices, but it could also be internal django apps or who 
> knows what else)
> * minimizing the impact of migrations during releases (aka we want to be 
> able to release in the middle of the afternoon
>
> Currently we put up a maintenance page whenever we are doing database 
> operations (aka migrations).  This seems like a recommended best practice.
>
> One way I was thinking about addressing this issue was to break all of our 
> models out into a separate repo.  That way we'd only need to deploy 
> migrations when the models themselves have deployed.  For code that needs 
> the models, we could pip install the repo as an app and away we go.  
> Likewise it seems like I could break up different parts of our app via a 
> similar strategy.
>
> Does this seem viable?  How have other people solved this kind of problem?
>
> Thanks,
>
> -Ben
>

-- 
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/5886e713-b5fb-4263-98e2-3afcde89ab3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fabric - Someone has a fabfile to build a Sentry server?

2016-04-05 Thread Daniel Chimeno
Hello,
Sentry is a server by itself, following the installation docs you could 
install one.
https://docs.getsentry.com/on-premise/server/


El martes, 5 de abril de 2016, 20:54:07 (UTC+2), Neto escribió:
>
> I need to build a server using nginx to run sentry, I needed a routine to 
> install all the necessary packages, and configure the server.
> I am using Ubuntu, Nginx, Django.
>

-- 
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/b3e3ebb1-6d84-45fa-abb0-83fa3b62af39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generate different querysets depending of the website language

2016-03-27 Thread Daniel Chimeno
Hello again,
In that case, I would double-check the middleware process and settings in 
your project.
One reason could be your are placing LocaleMiddleware after your 
ForceDefaultLanguage,
so https://github.com/django/django/blob/master/django/middleware/locale.py#L26
is setting the default language.

Hope it helps.
 
El sábado, 26 de marzo de 2016, 20:43:09 (UTC+1), Mathieu Poussin escribió:
>
> Hello,
>
> I have an issue, I am creating a website that will be available in many 
> languages, sharing the same database.
> Most models have a "language" attribute that is the 2 letters from the 
> language code (en, es, fr, etc.).
>
> I am trying to find a way to show the correct content per language.
>
> I tried many things, creating a custom manager :
>
> from django.utils.translation import get_language, get_language_info
> from django.db import models
>
> class PerLanguageManager(models.Manager):
> def get_queryset(self):
> if get_language():
> return super(PerLanguageManager, self).get_queryset().filter(
> language=get_language_info(get_language())['code'])
> else:
> return super(PerLanguageManager, self).get_queryset()
>
>
> Or overriding get_queryset using another method : (The language is always 
> present in the url as /en/ or /es/) 
>
> class RecipeIndexView(generic.ListView):
> paginate_by = 10
>
> def get_queryset(self):
> return 
> Recipe.objects.filter(language=get_language_from_request(self.request, 
> check_path=False))
>
> But nothing work, I always get the default configured language (even if 
> with the debug toolbar tell me the site is in another language, and all the 
> translations are correctly done in the language specified in the URL, I 
> always get the default language from the queries...)
>
> I'm using a specific middleware to ignore the language specified in the 
> browser to only use the language specified in the URL :
> class ForceDefaultLanguageMiddleware(object):
> """
> Ignore Accept-Language HTTP headers
>
> This will force the I18N machinery to always choose 
> settings.LANGUAGE_CODE
> as the default initial language, unless another one is set via 
> sessions or cookies
>
> Should be installed *before* any middleware that checks 
> request.META['HTTP_ACCEPT_LANGUAGE'],
> namely django.middleware.locale.LocaleMiddleware
> """
> def process_request(self, request):
> if 'HTTP_ACCEPT_LANGUAGE' in request.META:
> del request.META['HTTP_ACCEPT_LANGUAGE']
>
>
> Any idea of how to make this work ? What is the good way to do this ?
>
> Thank you.
> Mathieu
>
>

-- 
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/66d4859d-d61b-46ca-b3a0-3232da1c4786%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generate different querysets depending of the website language

2016-03-26 Thread Daniel Chimeno
Hello,

If you are able to change the schema I would suggest you to use 
modeltranslation [https://github.com/deschler/django-modeltranslation],
also the source code of that app can help you in order to take an specific 
approach to your project.

About the URL's, if you use i18urls, it has priority over the http headers 
[https://docs.djangoproject.com/en/1.9/topics/i18n/translation/#module-django.conf.urls.i18n]
 
(Not confirmed, but was true last time I checked it)


Hope it helps.

El sábado, 26 de marzo de 2016, 20:43:09 (UTC+1), Mathieu Poussin escribió:
>
> Hello,
>
> I have an issue, I am creating a website that will be available in many 
> languages, sharing the same database.
> Most models have a "language" attribute that is the 2 letters from the 
> language code (en, es, fr, etc.).
>
> I am trying to find a way to show the correct content per language.
>
> I tried many things, creating a custom manager :
>
> from django.utils.translation import get_language, get_language_info
> from django.db import models
>
> class PerLanguageManager(models.Manager):
> def get_queryset(self):
> if get_language():
> return super(PerLanguageManager, self).get_queryset().filter(
> language=get_language_info(get_language())['code'])
> else:
> return super(PerLanguageManager, self).get_queryset()
>
>
> Or overriding get_queryset using another method : (The language is always 
> present in the url as /en/ or /es/) 
>
> class RecipeIndexView(generic.ListView):
> paginate_by = 10
>
> def get_queryset(self):
> return 
> Recipe.objects.filter(language=get_language_from_request(self.request, 
> check_path=False))
>
> But nothing work, I always get the default configured language (even if 
> with the debug toolbar tell me the site is in another language, and all the 
> translations are correctly done in the language specified in the URL, I 
> always get the default language from the queries...)
>
> I'm using a specific middleware to ignore the language specified in the 
> browser to only use the language specified in the URL :
> class ForceDefaultLanguageMiddleware(object):
> """
> Ignore Accept-Language HTTP headers
>
> This will force the I18N machinery to always choose 
> settings.LANGUAGE_CODE
> as the default initial language, unless another one is set via 
> sessions or cookies
>
> Should be installed *before* any middleware that checks 
> request.META['HTTP_ACCEPT_LANGUAGE'],
> namely django.middleware.locale.LocaleMiddleware
> """
> def process_request(self, request):
> if 'HTTP_ACCEPT_LANGUAGE' in request.META:
> del request.META['HTTP_ACCEPT_LANGUAGE']
>
>
> Any idea of how to make this work ? What is the good way to do this ?
>
> Thank you.
> Mathieu
>
>

-- 
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/d6c35903-a95b-4117-bd75-30966ed56fd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to implement lazy settings as django setting

2016-03-03 Thread Daniel Chimeno
Hello,

https://www.djangopackages.com/grids/g/live-setting/



El miércoles, 2 de marzo de 2016, 16:53:09 (UTC+1), luisza14 escribió:
>
> I need to implement a lazy setting like django setting that could be call 
> globally in several apps but get his values from a model in database.
>
> I have some settings that need to be change by the admin user, so my apps 
> expect that settings but can not loaded on django setup because needs 
> populate with fields in db or something that user can change without 
> touching code.  So I thing I can implement a lazy setting that use database 
> in request process time and cached the result.
>
> So do you have some idea how to implement that.
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>

-- 
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/ff317794-8928-4610-9dbe-2d480f986956%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up django mailbox

2016-02-04 Thread Daniel Chimeno
This are the settings you should put:
https://support.google.com/mail/troubleshooter/1668960?rd=1#ts=1665018%2C1665144


El viernes, 5 de febrero de 2016, 2:04:44 (UTC+1), learn django escribió:
>
> I tried both but no luck.
>
> On Thursday, February 4, 2016 at 3:49:48 PM UTC-8, Dheerendra Rathor wrote:
>>
>> Are you sure imap.company.com is handling your imap server and not 
>> imap.google.com?
>>
>> On Thu, 4 Feb 2016 at 23:24 Daniel Chimeno <dan...@chimeno.me> wrote:
>>
>>> Hello,
>>> If you are writing about his project: 
>>> https://github.com/coddingtonbear/django-mailbox I guess
>>> it's better to ask in the issues page of that project: 
>>> https://github.com/coddingtonbear/django-mailbox/issues
>>>
>>>  
>>>
>>> El jueves, 4 de febrero de 2016, 23:02:36 (UTC+1), learn django escribió:
>>>
>>>> Hi,
>>>>
>>>> Am trying to setup django mailbox  from admin page and seeing issues.
>>>>
>>>> My email address is f...@company.com. We use google.com for our email 
>>>> service.
>>>>
>>>> My username is "a...@company.com", name is "abc abc" and password is 
>>>> "abc1234".
>>>>
>>>
>>>> Am putting following details on django_mailbox page.
>>>>
>>>> Name: "abc abc"
>>>>
>>> URI: "imap+ssl://abc%40company.com:abc1...@imap.company.com"
>>>> From email: "a...@company.com"
>>>>
>>>
>>>> I see following traceback on running "python manage.py getmail".
>>>> I have enabled imap under setting under google for my account.
>>>>
>>>> $ python manage.py getmail
>>>> /usr/local/lib/python2.7/dist-packages/djangosaml2/conf.py:20: 
>>>> RemovedInDjango19Warning: django.utils.importlib will be removed in Django 
>>>> 1.9.
>>>>   from django.utils.importlib import import_module
>>>>
>>>> Traceback (most recent call last):
>>>>   File "manage.py", line 10, in 
>>>> execute_from_command_line(sys.argv)
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>>  
>>>> line 338, in execute_from_command_line
>>>> utility.execute()
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>>  
>>>> line 330, in execute
>>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>>> line 390, in run_from_argv
>>>> self.execute(*args, **cmd_options)
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>>> line 441, in execute
>>>> output = self.handle(*args, **options)
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django_mailbox/management/commands/getmail.py",
>>>>  
>>>> line 24, in handle
>>>> messages = mailbox.get_new_mail()
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django_mailbox/models.py", line 
>>>> 393, in get_new_mail
>>>> connection = self.get_connection()
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django_mailbox/models.py", line 
>>>> 229, in get_connection
>>>> conn.connect(self.username, self.password)
>>>>   File 
>>>> "/usr/local/lib/python2.7/dist-packages/django_mailbox/transports/imap.py",
>>>>  
>>>> line 41, in connect
>>>> typ, msg = self.server.login(username, password)
>>>>   File "/usr/lib/python2.7/imaplib.py", line 519, in login
>>>> raise self.error(dat[-1])
>>>> imaplib.error: Login failed.
>>>>
>>>> Am unable to figure out what is happening here.
>>>> Any help is appreciated.
>>>> Thanks in advance.
>>>>
>>>> -- 
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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/7d0e657f-a3b0-42e4-821e-9b9c2c7ad15a%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/7d0e657f-a3b0-42e4-821e-9b9c2c7ad15a%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/19845882-720d-451c-8e69-5353b7e88a89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Handling cookies that contain illegal values

2016-02-04 Thread Daniel Chimeno
Hello, 

>
> I have resolved this in my instance as follows in django/http/cookie.py:
>
> def parse_cookie(cookie):
> cookie = re.sub('[^\x20-\x7e]+', 'X', cookie)
> ...
>
>
>
> It would be preferable to write that code in a middleware than in the 
Django code itself.
Before the middleware that handles the cookie (I guess it would be 
Session), you can *sanitize* that cookie.

Hope it helps.
 

-- 
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/281733d6-7480-4349-9404-572443bb4cc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up django mailbox

2016-02-04 Thread Daniel Chimeno
Hello,
If you are writing about his project: 
https://github.com/coddingtonbear/django-mailbox I guess
it's better to ask in the issues page of that project: 
https://github.com/coddingtonbear/django-mailbox/issues

 

El jueves, 4 de febrero de 2016, 23:02:36 (UTC+1), learn django escribió:
>
> Hi,
>
> Am trying to setup django mailbox  from admin page and seeing issues.
>
> My email address is f...@company.com . We use google.com for 
> our email service.
>
> My username is "a...@company.com ", name is "abc abc" and 
> password is "abc1234".
>
> Am putting following details on django_mailbox page.
>
> Name: "abc abc"
> URI: "imap+ssl://abc%40company.com:abc1...@imap.company.com "
> From email: "a...@company.com "
>
> I see following traceback on running "python manage.py getmail".
> I have enabled imap under setting under google for my account.
>
> $ python manage.py getmail
> /usr/local/lib/python2.7/dist-packages/djangosaml2/conf.py:20: 
> RemovedInDjango19Warning: django.utils.importlib will be removed in Django 
> 1.9.
>   from django.utils.importlib import import_module
>
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 338, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 330, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 390, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 441, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django_mailbox/management/commands/getmail.py",
>  
> line 24, in handle
> messages = mailbox.get_new_mail()
>   File "/usr/local/lib/python2.7/dist-packages/django_mailbox/models.py", 
> line 393, in get_new_mail
> connection = self.get_connection()
>   File "/usr/local/lib/python2.7/dist-packages/django_mailbox/models.py", 
> line 229, in get_connection
> conn.connect(self.username, self.password)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django_mailbox/transports/imap.py", 
> line 41, in connect
> typ, msg = self.server.login(username, password)
>   File "/usr/lib/python2.7/imaplib.py", line 519, in login
> raise self.error(dat[-1])
> imaplib.error: Login failed.
>
> Am unable to figure out what is happening here.
> Any help is appreciated.
> Thanks in advance.
>
>

-- 
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/7d0e657f-a3b0-42e4-821e-9b9c2c7ad15a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Scaling Django

2016-02-03 Thread Daniel Chimeno
As you said the project is using DRF for an API, it came to my mind some 
blog post I've read about it:

   - 
   
http://ses4j.github.io/2015/11/23/optimizing-slow-django-rest-framework-performance/
   - 
   https://www.dabapps.com/blog/api-performance-profiling-django-rest-framework/
   - 
   https://docs.djangoproject.com/es/1.9/ref/models/querysets/#prefetch-related
   
I'm sure with some little tricks (that shouldn't be tricks after all) 
you'll go over that situation.
As others said, first look the problem, then search the solution.

In that specific case that you are getting thousand of results from 
database, you can go further in:
- SQL
- Caching
- Serialize
- Pagination

Hope it helps.


El miércoles, 3 de febrero de 2016, 16:30:05 (UTC+1), Joshua Pokotilow 
escribió:
>
> At the startup where I work, we've written a lot of our server code in 
> Django. So far, we've adopted a "build it fast" mentality, so we invested 
> very little time in optimizing our code. A small amount of load testing has 
> revealed our codebase / infrastructure as it stands today needs to run 
> faster and support more users.
>
> We recently hired some new engineers who are extremely skeptical that we 
> should optimize our existing code. Their main concerns are:
>
> - We need to move to a service-oriented infrastructure because Django is 
> too monolithic (monolithic = technology lock-in & difficult to troubleshoot)
> - It's too easy to write slow queries using the Django ORM
> - It's hard to hire Django engineers
> - While Instagram and DISQUS use Django to service large numbers of 
> people, they don't use it for any serious backend work
>
> After having worked with Django for the last 3 years, I'm a big believer 
> in it, and I believe it would scale. To defend my position, I've pointed 
> out to my colleagues that it's easy to identify bottlenecks with tools like 
> the Django Debug Toolbar and Yet Another Django Profiler. With my 
> colleagues present, I've isolated and fixed significant speed problems 
> inside of a few hours. I don't believe the Django ORM is inherently bad, 
> although I do think that coders who use it should Know What They're Doing. 
> Finally, I've referenced blog entries that talk about how Instagram and 
> Disqus use Django on the backend for backend-y tasks.
>
> Despite my best efforts, my colleagues are still pushing to have us 
> rewrite large portions of our infrastructure as separate services before we 
> try to fix them. For example, we have one slow REST endpoint that returns a 
> boatload of user data, and so there's talk about using a new microservice 
> for users in lieu of our existing Django models. Even if we are able to fix 
> bottlenecks we encounter in a timely fashion, my colleagues fear that 
> Django won't scale with the business.
>
> I'm writing this post to garner additional evidence that Django will 
> scale. Anything compelling (and preferably not obvious) that would help 
> shed some light on Django's ability to scale would be *greatly* 
> appreciated, as it's very difficult for me to defend my position that 
> Django is a viable long-term solution without solid evidence to back up my 
> claims. It certainly doesn't help that I don't have any experience scaling 
> Django myself!
>
> Thank you.
>

-- 
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/b831b050-fb2f-4718-a9c6-610c6152865a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Manually setting the session cookie

2016-02-01 Thread Daniel Chimeno
Hello,

I'm sure some time ago I saw an app where you can change the current user 
logged (something like ``su user``), I can't remember the name sorry.


El lunes, 1 de febrero de 2016, 11:15:03 (UTC+1), monoBOT monoBOT escribió:
>
> Hello django!
>
> Im creating a saas with django, due to some project requirements need to 
> manually change the user "on the fly" but have problems with the cookie, 
> since I dont know how to manually (read programatically) set it.
>
> Any insights or a good place to start? Thanks!
>
>
> -- 
> *monoBOT*
> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>

-- 
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/2f78b1ba-01b6-468c-854d-4322589e7892%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Code organisation

2016-01-24 Thread Daniel Chimeno
Hello,
It seems that if you need (blog, comments, image manipulation), are you 
developing a custom CMS?
Maybe you find something useful here.
https://www.djangopackages.com/grids/g/cms/

El viernes, 22 de enero de 2016, 15:31:07 (UTC+1), Benj escribió:
>
> Hello,
>
> i’m building my first site with this great framework and language that are 
> Django and Python.
> I try as much as possible to favor code reuse.
>
> On one of my model, I do some work with the instance before saving it.
> Works is mostly image related: resizing image, compressing, saving thumbs, 
> and a couple more stuff.
>
> I will need this behavior in almost all the projects that I will building, 
> and even some other apps in the same project will need this feature: the 
> blog, the comments, the directory…..
>
> In this case, where to put this code ? What do guys and gals do usually in 
> this situation ? 
> Do you just put it in a custom (non app) folder like ‘my_utilities’ ?
>
> Advices welcome.
>
> Thanks,
> Benj
>

-- 
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/8def6a5c-cf24-4948-a73d-a78766e4bc87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how many visitors has view my posts and how many visitors view my site

2016-01-22 Thread Daniel Chimeno
I would say the same, use Google Analytics or another platform like Piwik

El viernes, 22 de enero de 2016, 17:09:34 (UTC+1), Lucas Magnum escribió:
>
> Thought about using Google Analytics for that?
>
> []'s
>
> Lucas Magnum.
>
> 2016-01-22 13:02 GMT-02:00 Xristos Xristoou  >:
>
>> hello,
>>
>>
>> i want to know  how many people view my site and how many view one to one 
>> my posts specific.
>> my site is simple i have two templates one with all my post and one with 
>> post details.
>> but i dont know how to do that i am new in django.
>>
>>
>> the start is to add a new field in my class
>>
>> view = models.IntegerField(default=0)
>>
>>
>> any idea ?any documentation to help me ?
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/50bcbc55-107b-4fec-b67b-9217aec5082d%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/b49e8965-76da-4caa-9237-7d4dd22e18a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: beginner for Django and Python

2015-12-26 Thread Daniel Chimeno
Hello,
As far as I know, the Django integration within PyCharm it's only the paid 
version, there is a official guide over here: 
https://www.jetbrains.com/pycharm/help/creating-django-project.html
Hope it helps.



El sábado, 26 de diciembre de 2015, 11:15:09 (UTC+1), Sahil Karkhanis 
escribió:
>
> Can someone please help me in understanding how to use Django using 
> Pycharm from scratch ... :) for Python 2.7.
> An Example or a Video will be very helpful, I went through the Django docs 
> but to integrate it with Pycharm was a bit difficult, so if anybody could 
> suggest me some videos, would be a great help.
> this is urgent please help. :)
>

-- 
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/cd52cc9a-024f-4997-a0ff-c3a3a4122cb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ajax POST request being sent as GET

2015-12-15 Thread Daniel Chimeno
Hello,

This is more  a jQuery issue than a Django one, but it could be because of 
the quotes.

From: http://api.jquery.com/jquery.ajax/

var menuId = $( "ul.nav" ).first().attr( "id" );
var request = $.ajax({
  url: "script.php",
  method: "POST",
  data: { id : menuId },
  dataType: "html"
});




 

El martes, 15 de diciembre de 2015, 23:25:12 (UTC+1), larry@gmail.com 
escribió:
>
> I am sending an ajax POST request like this: 
>
> $.ajax({ 
> url: url, 
> method: 'POST', 
> dataType: "json", 
> data: { 
> recipe: recpie 
> } 
> }) 
>
> But the request is being sent as a GET: 
>
> Request URL: http://127.0.0.1/api/update_measbox?recipe=MALBHDPOR 
> Request Method: GET 
> Status Code:200 OK 
> Remote Address:127.0.0.1:80 
>
> Any ideas as to why this is happening and how I can get it sent it as a 
> POST? 
>

-- 
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/004cad67-925f-41f9-b155-2b3c40d74673%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Gsoc 2016 contribution

2015-12-15 Thread Daniel Chimeno
Improve your Python skills.
Improve/learn your Django skills.
Stay tuned in the community :)


El martes, 15 de diciembre de 2015, 18:54:51 (UTC+1), Yash Sharan escribió:
>
> hello my name is Yash Sharan and i'm a first year student at BITS Pilani 
> Goa campus,India. i know basic python.How can i enhance my current skills 
> so that i may be able to contribute towards your projects during Gsoc 2016.
> Thanks
>

-- 
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/109c18b2-6a3a-4e9a-a30e-ba2a34f4fa31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Customizing Admin Layout and templates

2015-12-15 Thread Daniel Chimeno
Hello,
If you want to build a CMS, you could use some apps or projects that are 
out there:
https://www.djangopackages.com/grids/g/cms/

El martes, 15 de diciembre de 2015, 20:05:31 (UTC+1), Mayank Singhal 
escribió:
>
> Hello,
> I am new to django. I want to customize the admin panel templates and 
> layouts. How can i do that can somebody provide me the tutorial.
> I want to convert it in a panel like Wordpress or Joomla Admin Panel.
>

-- 
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/228facee-96a2-49d6-8b74-db36c24f6d83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple serializers

2015-12-11 Thread Daniel Chimeno
This question is more about DRF  than 
Django itself, I haven't use it for a while so I can't answer you,
but please, put the code in a proper format way or pastebin, and say the 
version you are using both Django and DRF
in order other people can answer you.


El jueves, 10 de diciembre de 2015, 19:27:26 (UTC+1), miguel angel lopez 
mendo escribió:
>
> i have this serializers 
>
> class ValuarCoche(serializers.ModelSerializer):
> class Meta:
> model = Valuacion
> depth = 6
> fields = ('coche','Precio_Venta','Precio_Compra')
>
> class CocheSerializer2(serializers.ModelSerializer):
> valuacion = ValuarCoche(many=True)
> class Meta:
> model = Coche
>
>
> fields = ('id', 'marca', 'modelo', 'version', 
> 'estado','anio','timestamp','valuacion')
>
>
> but don't work  i need that print 
>
>
> {
> "id": 3,
> "marca": {
> "id": 1,
> "nombre": "Acura"
> },
> "modelo": {
> "id": 1,
> "nombre": "ILX"
> },
> "version": "a5",
> "estado": "1",
> "anio": 2015,
> "timestamp": "2015-12-08T19:12:05.887126Z"
>
>  "Precio_Venta": 0,
>
> "Precio_Compra": 0
>
> },
>
>
>
> the error is the next 
>
>
> 
>

-- 
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/24599525-5a25-4688-a82c-0a52245b3a13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Como puedo regresar el ultimo elemento de mi base de datos

2015-11-20 Thread Daniel Chimeno
Hi,
This is an english version of the Django forum, there is another one (not 
official) in:
https://groups.google.com/forum/#!forum/django-es

Also please, use dpaste services or similar for code.

Regards,

El viernes, 20 de noviembre de 2015, 17:19:55 (UTC+1), miguel angel lopez 
mendo escribió:
>
>
> --mi view 
>
> Usados ​​def (solicitud):
> productos = Coche.objects.filter (tipo = '1')
> productos / usados.html '= plantilla
> volver render (solicitud, plantilla, locals ())
>
>
> template---
> {% Extends% 'base.html'}
> {Carga% staticfiles%}
> {% Block%} head_title
> {%}% Endblock
>
>
> 
>
>  Soni Compañia 
>
> 
>
> 
>
> {% Estilo de bloque%}
>
> cuerpo{
> margin: 0;
> padding: 0;
> }
>
> {%}% Endblock
> 
>
>
>
> {% Block content%}
>
> 
>
> {% Para el producto en los productos de%}
> 
> 
> 
> 
> {% If%} product.cocheimage_set.all
> {% Para el artículo en product.cocheimage_set.all%}
> 
>  
>  
> 
> {% Endfor%}
>
> {% más %}
> 
> 
>  
> 
>  
> {% terminara si %}
>
> 
>   {{}} product.title  
> 
> Marca: {{}}  product.marca
> Modelo: {{product.modelo}}
>Tomar Auto 
> 
>   
>
>
> 
>
> {% Ciclo "" "" "" "" "" "  "%}
> {% Endfor%}
>
>
>
>
> {%}% Endblock
> 
>
>
>
> ---models-
> clase Coche (models.Model):
> titulo = models.CharField (max_length = 120)
> marca = models.ForeignKey ('Marca', null = True, en blanco = True, 
> verbose_name = "Marca")
> Modelo = models.ForeignKey ('Modelo', null = True, en blanco = True)
> version = models.CharField (max_length = 120)
> tipo = models.CharField (max_length = 12, las opciones = TIPO_CHOICES)
> precio = models.DecimalField (decimal_places = 2, MAX_DIGITS = 100)
> babosa = models.SlugField (unique = True)
> timestamp = models.DateTimeField (auto_now_add = True, auto_now = 
> False)
> actualizado = models.DateTimeField (auto_now_add = False, auto_now = 
> True)
> activo = models.BooleanField (por defecto = True)
> 
> def __unicode __ (self):
> retorno self.titulo
>
> clase Meta:
> unique_together = ('titulo', 'bala')
>
> get_absolute_url def (self):
> inversa volver ("single_product", kwargs = {"babosa": self.slug})
>
>
> CocheImage clase (models.Model):
> producto = models.ForeignKey (Coche)
> image = models.ImageField (upload_to "productos / images / '=)
> destacado = models.BooleanField (default = false)
> miniatura = models.BooleanField (por defecto = True)
> activo = models.BooleanField (por defecto = True)
> actualizado = models.DateTimeField (auto_now_add = False, auto_now = 
> True)
>
> def __unicode __ (self):
> retorno self.product.titulo
>
>
> Lo que intento realizar es que en el template se muestre solamente la 
> ultima imagen que he subido
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9d75632-90be-43e0-826a-1d26725dad90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-16 Thread Daniel Chimeno


El miércoles, 16 de septiembre de 2015, 15:20:32 (UTC+2), bobhaugen 
escribió:
>
> You gotta give PHP credit here. They did deployment better than anybody.
>
+1
 

> Django as a community could stand to put more concentrated work into 
> deployment.
>
That was my unique constraint in the last Django survey.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4326a8e-3df0-48b4-a26d-bfc3d304b902%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Designing Model Widgets to Business Analytics app

2014-08-15 Thread Daniel Chimeno
First, Hello all. This is my first post here in django-users, hope I'm 
doing it well.

This question is not django - specific but since I'm using our loved tool, 
I though it could be a good place to post it.

I am developing a business analytics like app, and I have some models like 
this:


class AccountStats(models.Model):
"""
Model to save relevant information about the account.
This data is going to be the relative to the graphs.
"""
account = models.ForeignKey(Account, related_name='stats')

fetch_date = models.DateTimeField(...)
emails_count = models.PositiveIntegerField('...')
friends_count = models.PositiveIntegerField(' ')
favourites_count = models.PositiveIntegerField()
listed_count = models.PositiveIntegerField(''')
writes_count = models.PositiveIntegerField(''')

And the User model provided by Django.

So, now I can  write template files with charts embedded on them. (I'm 
using HighCharts js) doing some
ORM calls, manipulating received data in views and writing the js and html 
in templates.

My next step will be create Widgets models, in order to reuse code.
So for example, create a Widget that will be 'Friends Count', it will be a 
Line Chart and it will call the 
ORM call (pseudo)[SELECT friends_count FROM AccountStats GROUP BY 
fetch_date('Day') ].

While I'm writing this I'm realize that maybe an approach will be write 
several template .html files and then {% include them %}
with the right objects.

So how could I go with it? Any direction, approach or examples to solve 
this?
So many thanks.

PD. Sorry, not native english speaker.





-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e58e450-7775-4801-b60e-e9f7c11f326d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.