Re: Django context translations with dynamic variables

2017-03-02 Thread Jani Tiainen

Hi,


On 02.03.2017 19:43, Uri Even-Chen wrote:

What if we "cheat" makemessages like this:

{% if 0%}{% trans 'This user blocked you.' context 'female' %} {% 
trans 'This user blocked you.' context 'male' %} {% trans 'This user 
blocked you.' context 'other' %} {% endif %}

{%trans 'This user blocked you.' context user.gender %}
(or maybe we should filter user.gender with a filter that returns 
"female", "male" or "other" (because they are integers).


It looks better to me and less work to "cheat" makemessages like this, 
unless there is a better solution? Because translations which don't 
exist in the code will be commented every time we run makemessages. 
Maybe this is a feature we can add to the next Django release? And 
then we will not have to "cheat"?


This will be really problematic.

First, how makemessage command would know all the possible values of 
"user.gender"? Where that information would be obtained? It must be 
available somewhere when processing strings for translations.


If user.gender is fixed list and you know that, you could pick existing 
code of makemessages and enhance it with your custom code that magically 
knows values for user.gender. So you need to code that part yourself and 
it would be special command to your app(s).


Another option that Melvyn suggested is to have totally custom tag that 
contains possible values and then variable to choose among them. That 
could work just fine, but still you need to do custom makemessages 
command that would understand your tag and it's syntax.


Makemessages managemen command code can be found at:
https://github.com/django/django/blob/master/django/core/management/commands/makemessages.py

--
Jani Tiainen

--
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/0855de33-0ab9-2a01-595a-374674e6a9df%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


django angular

2017-03-02 Thread mohamed shawky
how to save data which it come from angular in data base

-- 
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/eb01cf3a-7d13-458f-b369-4d7ebefae066%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Pressing enter/return key does not submit the list_editable in Django admin

2017-03-02 Thread Leo Shao
I'm assuming this is because there are two submit buttons in one form and 
when pressing enter (while focused on an input), it submits the action 
(e.g. delete) rather than the list_editable. 

When I press enter (while focused on an 'hours' input), it reacts the same 
as if I pressed the "Go" button next to the dropdown.
Is there a fix I could make?
Should I submit this as a bug?

-- 
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/0cb507c5-989c-442a-8124-9141ce54e09b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to keep track of online users?

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 14:47:30 Branko Zivanovic wrote:
> I need to know online status for each user. How do I do that?

from importlib import import_module
from django.conf import settings
from django.contrib.auth import get_user_model

engine = import_module(settings.SESSION_ENGINE)
# docs[1] 
store = engine.SessionStore()
store.clear_expired()
logged_in = []
User = get_user_model()

for session in store.model.objects.all():
decoded = store.decode(session.session_data)
if '_auth_user_id' in decoded:
try:
user = 
User.objects.get(id=decoded['_auth_user_id']
logged_in.append(user)
except user.DoesNotExist:
pass

Of course, since by default the session length is 2 weeks, this doesn't tell 
you much, 
so if you want true "online status" you'd need to use your own session store to 
store 
the additional "last_online" field and middleware to update it automatically. 
Code 
above contains ample hints for you to start digging.

-- 
Melvyn Sopacua


[1] 
https://docs.djangoproject.com/en/1.10/topics/http/sessions/#the-sessionstore-object

-- 
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/2455389.gCFC5l7jYP%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: How to keep track of online users?

2017-03-02 Thread Shawn Milochik
You actually can't, unless you're using JavaScript for something like
websockets or other polling. You can only track their last activity using
their session.

Specifically, if a user loads one of your pages, you know it. But then you
won't know whether they're still reading it hours later or they closed
their browser immediately unless you use JavaScript in some form.

-- 
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/CAOzwKwFvnJaKjesPASaeyTk5cGG3_hXiNWCVNshRAu6MLz7JSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 20:54:07 Uri Even-Chen wrote:
> > Then makemessages should generate a string with msgctxt for each of
> > the choices. You could do this already, by rolling your own "trans"
> > tag and "makemessages" command.
> > 
> > 
> I don't understand, how can I do it already? I want makemessages to 
> generate a string with all the possible contexts (which may be for
> example 3 options or 9), and not to have to "cheat" it by {% if 0 %}
> etc. But how do I do it? By the way where is the makemessages code?

Wel, you can create your own commands:
https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/

And your own tags:
https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/

So if waiting for a next release that may or may not have this functionality 
does not fit 
your timeline, this is what you can do.
-- 
Melvyn Sopacua

-- 
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/13687055.55Y0b6FeVc%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Test Client response.json() UnicodeDecodeError

2017-03-02 Thread Aniruddha Maru
Running into the same issue - charset isn't correct, I think it ought to be 
hardcoded to `utf-8`.

On Thursday, March 31, 2016 at 5:24:39 AM UTC-7, Tim Graham wrote:
>
> Looks reasonable, although I am not entirely clear what role charset has 
> in a JsonResponse. See https://code.djangoproject.com/ticket/23949.
>
> On Thursday, March 31, 2016 at 6:15:53 AM UTC-4, Daniel Blasco wrote:
>>
>> Hi,
>>
>> I'm testing the REST API of my application and I found an error that I 
>> think that's a Django's issue.
>>
>> I'm using:
>>
>>- Django==1.9.4
>>- djangorestframework==3.3.3
>>
>>
>> I have set the rest framework setting UNICODE_JSON to True.
>>
>> When i'm testing a JSON response that contains a special character like 
>> 'á' then I get a UnicodeDecodeError. This is the traceback:
>>
>> Traceback (most recent call last):
>>   File ".../tests/assets/test_views.py", line 584, in test_get
>> response.json()
>>   File ".../lib/python2.7/site-packages/django/utils/functional.py", line 
>> 13, in _curried
>> return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))
>>   File ".../lib/python2.7/site-packages/django/test/client.py", line 662, 
>> in _parse_json
>> return json.loads(response.content.decode(), **extra)
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 268: 
>> ordinal not in range(128)
>>
>>
>> If I change the line 662 in django/test/client.py to:
>>
>> return json.loads(response.content.decode(*response.charset*), **extra)
>>
>> then it works fine. In this case response.charset is utf-8.
>>
>>
>> Thanks,
>> Daniel
>>
>

-- 
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/cacd05db-9ab3-455b-b16f-52719b7337cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Test Client response.json() UnicodeDecodeError

2017-03-02 Thread Aniruddha Maru
Filed as https://code.djangoproject.com/ticket/27895

On Thursday, March 2, 2017 at 2:59:46 PM UTC-8, Aniruddha Maru wrote:
>
> Running into the same issue - charset isn't correct, I think it ought to 
> be hardcoded to `utf-8`.
>
> On Thursday, March 31, 2016 at 5:24:39 AM UTC-7, Tim Graham wrote:
>>
>> Looks reasonable, although I am not entirely clear what role charset has 
>> in a JsonResponse. See https://code.djangoproject.com/ticket/23949.
>>
>> On Thursday, March 31, 2016 at 6:15:53 AM UTC-4, Daniel Blasco wrote:
>>>
>>> Hi,
>>>
>>> I'm testing the REST API of my application and I found an error that I 
>>> think that's a Django's issue.
>>>
>>> I'm using:
>>>
>>>- Django==1.9.4
>>>- djangorestframework==3.3.3
>>>
>>>
>>> I have set the rest framework setting UNICODE_JSON to True.
>>>
>>> When i'm testing a JSON response that contains a special character like 
>>> 'á' then I get a UnicodeDecodeError. This is the traceback:
>>>
>>> Traceback (most recent call last):
>>>   File ".../tests/assets/test_views.py", line 584, in test_get
>>> response.json()
>>>   File ".../lib/python2.7/site-packages/django/utils/functional.py", 
>>> line 13, in _curried
>>> return _curried_func(*(args + moreargs), **dict(kwargs, 
>>> **morekwargs))
>>>   File ".../lib/python2.7/site-packages/django/test/client.py", line 
>>> 662, in _parse_json
>>> return json.loads(response.content.decode(), **extra)
>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 
>>> 268: ordinal not in range(128)
>>>
>>>
>>> If I change the line 662 in django/test/client.py to:
>>>
>>> return json.loads(response.content.decode(*response.charset*), **extra)
>>>
>>> then it works fine. In this case response.charset is utf-8.
>>>
>>>
>>> Thanks,
>>> Daniel
>>>
>>

-- 
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/0a543b26-bd41-4bb1-b546-6ff46956aad6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to keep track of online users?

2017-03-02 Thread Branko Zivanovic
I need to know online status for each user. How do I do that?

-- 
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/f5a2d5e2-093c-4e61-b00c-b47584f61c23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Field Default Value Serialization

2017-03-02 Thread qilin qi
Hi All,


Apologize if this question has been asked before. This is my first question
into this mailing list.

I am creating a custom field(MyCustomField) with a custom value
class(MyValue). I do have a deconstruct() method for my *field* class. And
I would like to have a default value of this field.

class MyModel(models.Model):
myValue = MyCustomField(default = MyValue(args))


But when I do the migration, error happens and I realized I need a
deconstruct() method(or @deconstructible) my *value* class. (https://docs.
djangoproject.com/en/1.10/topics/migrations/#custom-deconstruct-method) to
serialize the default value. There is no error after I do that. But my
question is,


Based on the guide, I am supposed to be able to write a custom field using
existing value class which I don't have access to the source. Quote below,

"In order to use the Hand class in our models, we *do not* have to change
this class at all. This is ideal, because it means you can easily write
model support for existing classes where you cannot change the source code."

from: https://docs.djangoproject.com/en/1.10/howto/custom-model-fields/

So is giving a deconstruct() method and probably a __eq__() method violate
this principle? I know I can subclass the existing class. But is it what I
supposed to do? I just want to make sure my understanding is correct and
what is the right design rule here?


Thanks

-- 
Qilin Qi

-- 
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/CA%2BTBJyh6RyRPDOSPrqERnTtzAp94ONsjxYdoD1-4EEW0vf30YA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice: django deploy vps error 502

2017-03-02 Thread Antonis Christofides
350 concurrent requests for a single machine is really much. If your app is very
fast (e.g. by caching stuff a lot) it might be possible, but again it might
require some tuning (for example, you could increase the gunicorn workers, but
you need to be monitoring RAM consumption).

Do you really need 350 concurrent requests? Do you have 100 thousand users?

Antonis Christofides
http://djangodeployment.com

On 03/02/2017 07:54 PM, carlos wrote:
> Hi, ok i change the uwsgi to gunicorn right now, the problem with error 502 in
> this moment he disappeared
> but the website in time it gets slow i dont now what is.
> this is the all syslog for today i this moments
>
> Mar  2 17:21:02 prueba gunicorn[1834]: [2017-03-02 17:21:02 +] [21405]
> [INFO] Booting worker with pid: 21405
> Mar  2 17:25:01 prueba CRON[21454]: (root) CMD (command -v debian-sa1 >
> /dev/null && debian-sa1 1 1)
> Mar  2 17:25:23 prueba gunicorn[1834]: [2017-03-02 17:25:23 +] [1834]
> [CRITICAL] WORKER TIMEOUT (pid:1844)
> Mar  2 17:25:24 prueba gunicorn[1834]: [2017-03-02 17:25:24 +] [21459]
> [INFO] Booting worker with pid: 21459
> Mar  2 17:35:01 prueba CRON[21563]: (root) CMD (command -v debian-sa1 >
> /dev/null && debian-sa1 1 1)
> Mar  2 17:37:43 prueba gunicorn[1834]:
> /home/user/virtuales/website/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110:
> Warning: Invalid utf8mb4 character string: 'F1613B'
> Mar  2 17:37:43 prueba gunicorn[1834]:   return self.cursor.execute(query, 
> args)
> Mar  2 17:37:43 prueba gunicorn[1834]:
> /home/user/virtuales/website/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110:
> Warning: Incorrect string value: '\xF1a;FBI...' for column 'user_agent' at 
> row 1
> Mar  2 17:37:43 prueba gunicorn[1834]:   return self.cursor.execute(query, 
> args)
> Mar  2 17:45:01 prueba CRON[21679]: (root) CMD (command -v debian-sa1 >
> /dev/null && debian-sa1 1 1)
>
> any good config for nginx and gunicor for high traffic website??
>
> or stop atack for many people make test like ab or other tools??
>
>
> thank for you help
>
>
>
> On Thu, Mar 2, 2017 at 2:57 AM, Antonis Christofides
> mailto:anto...@djangodeployment.com>> wrote:
>
> Your logs contain this:
>
> IOError: write error
>
> However, more information is needed in order to understand what is going
> on. A simple "write error" on its own is insufficient—is it a hardware
> error? Too many open files? Out of disk space? Something else? If your
> system writes nothing else in /var/log/syslog at the time the error
> occurs, it may be the fault of uwsgi that it doesn't show more information
> about the error. Try to increase error message verbosity, if there is an
> option to do that.
>
> Incidentally, the reason I migrated from uwsgi to gunicorn a few years ago
> was that every once in a while I was having a different problem with
> uwsgi, which was taking me hours to solve, largely because of insufficient
> documentation. After I switched to gunicorn I never looked back.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> http://djangodeployment.com
>
>
> On 03/01/2017 05:33 PM, carlos wrote:
>> Hello, Antonis i have debug = false, yes
>> uwsgi dont write anything in the log :/
>> When i see the syslog i see error but not understand!
>> i share this output
>>
>> http://pastebin.com/69yvC8Tz
>>
>> thak for you help
>>
>> On Wed, Mar 1, 2017 at 12:58 AM, Antonis Christofides
>> mailto:anto...@djangodeployment.com>> 
>> wrote:
>>
>> Hello,
>>
>> 502 usually means the backend isn't running. After you finish the
>> test, has the backend stopped running? Does it continue to throw
>> 502s? If that is the case, I'm wildly guessing that processes might
>> be growing and growing in memory and being eventually killed, but I
>> don't really know. Do you have DEBUG = False? Does uwsgi write
>> something in its log? Does the system write something in the syslog?
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides
>> http://djangodeployment.com
>>
>>
>> On 02/28/2017 10:49 PM, carlos wrote:
>>> Hi, all 
>>> i have one vps for one application,
>>>
>>>  vps description
>>>
>>> 16GB RAM
>>> 8 core processor
>>> 160 GB SSD
>>> 6TB Transfer
>>>
>>> ok, i am using, uwsgi(2.0.14), nginx(1.10), mysql(5.6 )and ubuntu
>>> 16.04 LTS
>>> this site working well when is visited or hits 1k even 6k, but when
>>> visited 10k or 12k
>>> raiser error 502,
>>>
>>> When I do a test of ab like these command line
>>> ab -k -c 350 -n 2 mydomain.com/ 
>>> again raiser the error 502 in almost pages
>>>
>>> these are configs all, wsgi, nginx
>>>
>>>  uwsgi script in /etc/uwsgi/app-availabre/

UI widget for contacting administrators

2017-03-02 Thread Branko Zivanovic
Hey Google,

Is there any django app that would allow users to report bugs, or send 
messages instantly from my index page?
 I want it to be like UI widget and visitors can simply report bugs, speak 
their ideas or opinion.
 Something similar to Olark, but I don't want it to be live chat because I 
can't reply on their messages instantly.

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/10d8e26c-978b-4f86-9830-292d71f51336%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
>
>
> Then makemessages should generate a string with msgctxt for each of the
> choices. You could do this already, by rolling your own "trans" tag and
> "makemessages" command.
>
>
> I don't understand, how can I do it already? I want makemessages to
generate a string with all the possible contexts (which may be for example
3 options or 9), and not to have to "cheat" it by {% if 0 %} etc. But how
do I do it? By the way where is the makemessages code?

*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700 <+972-54-3995700>
Email: u...@speedy.net 
Website: http://www.speedysoftware.com/uri/en/

  
    


-- 
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/CAMQ2MsHFyBP1CJzojXFDKx_vUsNXsUq08nSNOVtLb6%2BM1EY-1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 19:43:07 Uri Even-Chen wrote:


> Maybe this is a feature we can add to the next Django release? And
> then we will not have to "cheat"?



Something like this maybe:

{%trans 'dancer' context_choices=gender_choices 
choice=request.user.gender %}

Then makemessages should generate a string with msgctxt for each of the 
choices. You could do this already, by rolling your own "trans" tag and 
"makemessages" command.
-- 
Melvyn Sopacua

-- 
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/1534636.BJoEb0gUWS%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Advice: django deploy vps error 502

2017-03-02 Thread carlos
Hi, ok i change the uwsgi to gunicorn right now, the problem with error 502
in this moment he disappeared
but the website in time it gets slow i dont now what is.
this is the all syslog for today i this moments

Mar  2 17:21:02 prueba gunicorn[1834]: [2017-03-02 17:21:02 +] [21405]
[INFO] Booting worker with pid: 21405
Mar  2 17:25:01 prueba CRON[21454]: (root) CMD (command -v debian-sa1 >
/dev/null && debian-sa1 1 1)
Mar  2 17:25:23 prueba gunicorn[1834]: [2017-03-02 17:25:23 +] [1834]
[CRITICAL] WORKER TIMEOUT (pid:1844)
Mar  2 17:25:24 prueba gunicorn[1834]: [2017-03-02 17:25:24 +] [21459]
[INFO] Booting worker with pid: 21459
Mar  2 17:35:01 prueba CRON[21563]: (root) CMD (command -v debian-sa1 >
/dev/null && debian-sa1 1 1)
Mar  2 17:37:43 prueba gunicorn[1834]:
/home/user/virtuales/website/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110:
Warning: Invalid utf8mb4 character string: 'F1613B'
Mar  2 17:37:43 prueba gunicorn[1834]:   return self.cursor.execute(query,
args)
Mar  2 17:37:43 prueba gunicorn[1834]:
/home/user/virtuales/website/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110:
Warning: Incorrect string value: '\xF1a;FBI...' for column 'user_agent' at
row 1
Mar  2 17:37:43 prueba gunicorn[1834]:   return self.cursor.execute(query,
args)
Mar  2 17:45:01 prueba CRON[21679]: (root) CMD (command -v debian-sa1 >
/dev/null && debian-sa1 1 1)

any good config for nginx and gunicor for high traffic website??

or stop atack for many people make test like ab or other tools??


thank for you help



On Thu, Mar 2, 2017 at 2:57 AM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Your logs contain this:
>
> IOError: write error
>
> However, more information is needed in order to understand what is going
> on. A simple "write error" on its own is insufficient—is it a hardware
> error? Too many open files? Out of disk space? Something else? If your
> system writes nothing else in /var/log/syslog at the time the error occurs,
> it may be the fault of uwsgi that it doesn't show more information about
> the error. Try to increase error message verbosity, if there is an option
> to do that.
>
> Incidentally, the reason I migrated from uwsgi to gunicorn a few years ago
> was that every once in a while I was having a different problem with uwsgi,
> which was taking me hours to solve, largely because of insufficient
> documentation. After I switched to gunicorn I never looked back.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 03/01/2017 05:33 PM, carlos wrote:
>
> Hello, Antonis i have debug = false, yes
> uwsgi dont write anything in the log :/
> When i see the syslog i see error but not understand!
> i share this output
>
> http://pastebin.com/69yvC8Tz
>
> thak for you help
>
> On Wed, Mar 1, 2017 at 12:58 AM, Antonis Christofides <
> anto...@djangodeployment.com> wrote:
>
>> Hello,
>>
>> 502 usually means the backend isn't running. After you finish the test,
>> has the backend stopped running? Does it continue to throw 502s? If that is
>> the case, I'm wildly guessing that processes might be growing and growing
>> in memory and being eventually killed, but I don't really know. Do you have
>> DEBUG = False? Does uwsgi write something in its log? Does the system write
>> something in the syslog?
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>>
>> On 02/28/2017 10:49 PM, carlos wrote:
>>
>> Hi, all
>> i have one vps for one application,
>>
>>  vps description
>>
>> 16GB RAM
>> 8 core processor
>> 160 GB SSD
>> 6TB Transfer
>>
>> ok, i am using, uwsgi(2.0.14), nginx(1.10), mysql(5.6 )and ubuntu 16.04
>> LTS
>> this site working well when is visited or hits 1k even 6k, but when
>> visited 10k or 12k
>> raiser error 502,
>>
>> When I do a test of ab like these command line
>> ab -k -c 350 -n 2 mydomain.com/
>> again raiser the error 502 in almost pages
>>
>> these are configs all, wsgi, nginx
>>
>>  uwsgi script in /etc/uwsgi/app-availabre/website.ini -
>> http://pastebin.com/vQW47WGb
>>
>>  nginx conf in /etc/nginx/nginx.conf  --
>> http://pastebin.com/5BsWWaps
>>
>> - nginx vhost for my website mydpmain 
>> http://pastebin.com/bMPvmrwR
>>
>> How can I do so that the site does not throw the error?
>>
>> Are the settings correct?
>>
>> How can i know the layer support the vps?
>>
>> In nginx how to stop the ab test, if many people do the test the web site
>> throws the error 502 ngixn
>>
>> I would appreciate it if someone gave me an idea or advice to configure
>> better when there is high traffic or are doing ab test or another
>> benchmarking test
>>
>> cheers
>>
>> --
>> att.
>> Carlos Rocha
>> --
>> 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.
>> 

Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
What if we "cheat" makemessages like this:

{% if 0 %}
{% trans 'This user blocked you.' context 'female' %}
{% trans 'This user blocked you.' context 'male' %}
{% trans 'This user blocked you.' context 'other' %}
{% endif %}

{% trans 'This user blocked you.' context user.gender %}

(or maybe we should filter user.gender with a filter that returns "female",
"male" or "other" (because they are integers).

It looks better to me and less work to "cheat" makemessages like this,
unless there is a better solution? Because translations which don't exist
in the code will be commented every time we run makemessages. Maybe this is
a feature we can add to the next Django release? And then we will not have
to "cheat"?

Thanks,
Uri.

*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
  
    


On Thu, Mar 2, 2017 at 4:00 PM, Jani Tiainen  wrote:

> Unfortunately makemessages can't guess what your context is if it's
> variable (I'm not sure would it even consider it as a translatable text at
> all)
> First version would guarantee you to have translatable strings with
> genders, latter one either generates one string (and you have to manually
> create missing ones) or it won't find it at all.
>
> You could test that very quickly with simple template with given fragments.
>
>
> On 02.03.2017 14:59, Uri Even-Chen wrote:
>
> Hi,
>
> I'm working with Gleb on Speedy Match [
> https://github.com/
> urievenchen/speedy-net]. We need to translate to Hebrew according to
> context of the user's gender. Gleb suggested that the code will be
> something like this:
>
> {% if user.gender == GENDER_FEMALE %}
> {% trans 'This user blocked you.' context 'female' %}{% elif user.gender 
> == GENDER_MALE  %}
> {% trans 'This user blocked you.' context 'male' %}
> {% else %}
> {% trans 'This user blocked you.' context 'other' %}
> {% endif %}
>
>
> But, is it possible to change it to something like this:
>
> {% trans 'This user blocked you.' context user.gender %}
>
> While still auto-generate the django.po files? Genders are always either
> "female", "male" or "other". But some text may be related to genders of 2
> users - the one using the site right now and another user. How do we do it
> then? I was thinking about context like "female_female", "female_male" etc.
> Anyway we don't want the templates to include many times the same text (3
> or 9 times), we prefer that each text will appear only once.
>
> Thanks,
> Uri.
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Email: u...@speedy.net
> Website: 
> http://www.speedysoftware.com/uri/en/
> 
> 
>   
> 
>
> On Wed, Mar 1, 2017 at 4:15 PM, Jani Tiainen  wrote:
>
>> In theory you just define genders to your PO file with translations and
>> it should work.
>>
>> Not sure will that disable autogeneration and update for your PO file
>> after that.
>> On 01.03.2017 14:59, Gleb Tocarenco wrote:
>>
>> Hello,
>>
>> I am running in with an issue with Django translation tag in case context
>> is present as a dynamic variable.
>>
>> {% trans 'You have new message' context user.gender %}
>>
>>
>> In this case django.po files doesn't contains words related to gender
>> context.
>>
>> My question is if there is possibility to use context in translation tag
>> as dynamic variable and generate django.po records based on it?
>>
>>
>> --
>> 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/5c01a596-23a2
>> -418f-9045-44a947efde0d%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Jani Tiainen
>>
>> --
>> 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 

Re: Unique model field and case sensitivity (postgres)

2017-03-02 Thread George Orw
So if i add unique index to a column in PostgreSQL, do i need to do any 
other changes in the django itself ? 

I am asking this because, MySQL have this functionality enabled by default 
without creating any special methods.

On Monday, December 7, 2009 at 5:33:11 PM UTC+5:30, David De La Harpe 
Golden wrote:
>
> chefsmart wrote: 
> > By the way, right now I'm using a State.objects.get(name__iexact=name) 
> > in clean_name() method in a form subclass to prevent creation of case- 
> > insensitive duplicates. Just wondering if there is a built-in or 
> > better way. 
> > 
>
> Well, in postgresql itself one can make a case insensitive unique 
> constraint using "functional index" functionality: 
>
> create unique index app_state_lower_name_idx on app_state(lower(name)); 
>
> as per: http://archives.postgresql.org/pgsql-general/2005-09/msg00842.php 
>
>
> I guess django's ORM would need some surgery to make it automagically 
> generate and manage such constraints though. 
>
>
>

-- 
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/688c5ddb-9a1d-4b87-b0ea-f01eb7a7623a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having trouble with Django tutorial

2017-03-02 Thread Vijay Khemlani
Did you do this step?

The next step is to point the root URLconf at the polls.urls module. In
mysite/urls.py, add an import for django.conf.urls.include and insert an
include()
 in
the urlpatterns list, so you have:
mysite/urls.py

from django.conf.urls import include, urlfrom django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),]


On Thu, Mar 2, 2017 at 11:40 AM, Yves S. Garret 
wrote:

> Hi all,
>
> I'm going through this tutorial:
> https://docs.djangoproject.com/en/1.10/intro/tutorial01/
>
> And the problem that I'm having is when I start the 'polls' application
> from inside my project and then go to localhost:8000/polls, I get a 404.
>
> Page not found (404)
> Request Method: GET
> Request URL: http://localhost:8000/polls
>
> Using the URLconf defined in learning_python.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>
> The current URL, polls, didn't match any of these.
>
>
> I did everything as the tutorial told me, so I'm a little bit lost as to
> why this is happening.  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/56610bfb-c82b-426c-8346-ec8abe2300d5%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/CALn3ei1KPoBvt%2B93b7ni9m4M%3DZ1Y_kSQQcTY1x1uyd2x5D6gBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: attribute required and error XML

2017-03-02 Thread chun974
Thanks, ludovic coues,
I have find the solution. I used eclipse whith django. In the setting.py I 
have modify (DEFAULT_CONTENT_TYPE='application/xhtml+xml') to 
(DEFAULT_CONTENT_TYPE='text/html'). It's OK with this. You're right!!
Thanks :) !

Le mercredi 1 mars 2017 10:53:54 UTC+1, ludovic coues a écrit :
>
> I can't answer on your issue exactly, but  is not an XML 
> doctype. It's the html5 doctype which as far as I know is SGML and not XML.
>
> Try removing the line starting with 
> On 28 Feb 2017 7:46 p.m., "chun974" > 
> wrote:
>
> Hi all,
> I have  an problem. When I use the django library  form, It create an 
> attribute "required" for an input. But when I look on my explorer (firefox 
> or chrome or IE) i have a XML error. 
>
> "XML parsing error: malformed".
>
> this is my code : 
> "
> class LoginForm(forms.Form):
> email = forms.EmailField(label='Courriel :')
> password = forms.CharField(label='Mot de passe :',
> widget = forms.PasswordInput) 
>  
> def clean(self):
> cleaned_data = super (LoginForm,self).clean()
> email = cleaned_data.get("email")
> password = cleaned_data.get("password")
> if email and password:
> if password != 'bob' or email != 'b...@bob.fr ' :
> raise forms.ValidationError("Adresse de courriel ou mot de 
> passe erroné.")   
> return cleaned_data
> "
>
> this is my déclaration for XML and doctype : 
> "
> 
> 
>
> http://www.w3.org/1999/xhtml"; xml:lang="fr"> "
>
> I can put "required=False" and it's OK, but I want that my input is required 
> (required=True it's not OK)
> XML don't accept that required  attribute is alone, whithout "= someting".
>
> If someone has had this problem? 
>
> Django 1.10
> Firefox last update
>
> -- 
> 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/8cb6a10b-fc89-4f9a-814e-a905ea9eef6b%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/9d0c5f4b-92e0-43fc-a161-ae088655a013%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Having trouble with Django tutorial

2017-03-02 Thread Yves S. Garret
Hi all,

I'm going through this tutorial:
https://docs.djangoproject.com/en/1.10/intro/tutorial01/

And the problem that I'm having is when I start the 'polls' application 
from inside my project and then go to localhost:8000/polls, I get a 404.

Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/polls

Using the URLconf defined in learning_python.urls, Django tried these URL 
patterns, in this order:

   1. ^admin/

The current URL, polls, didn't match any of these.


I did everything as the tutorial told me, so I'm a little bit lost as to 
why this is happening.  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/56610bfb-c82b-426c-8346-ec8abe2300d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-02 Thread Jani Tiainen
Unfortunately makemessages can't guess what your context is if it's 
variable (I'm not sure would it even consider it as a translatable text 
at all)


First version would guarantee you to have translatable strings with 
genders, latter one either generates one string (and you have to 
manually create missing ones) or it won't find it at all.


You could test that very quickly with simple template with given fragments.

On 02.03.2017 14:59, Uri Even-Chen wrote:

Hi,

I'm working with Gleb on Speedy Match 
[https://github.com/urievenchen/speedy-net]. We need to translate to 
Hebrew according to context of the user's gender. Gleb suggested that 
the code will be something like this:


{%if user.gender == GENDER_FEMALE%}{% trans 'This user blocked you.' context 'female' %} {%elif user.gender == GENDER_MALE%}{% trans 'This user blocked you.' context 'male' %} {% else %} {% 
trans 'This user blocked you.' context 'other' %} {% endif %}


But, is it possible to change it to something like this:

{%trans 'This user blocked you.' context user.gender %}
While still auto-generate the django.po files? Genders are always 
either "female", "male" or "other". But some text may be related to 
genders of 2 users - the one using the site right now and another 
user. How do we do it then? I was thinking about context like 
"female_female", "female_male" etc. Anyway we don't want the templates 
to include many times the same text (3 or 9 times), we prefer that 
each text will appear only once.


Thanks,
Uri.

*Uri Even-Chen*

photo   Phone:+972-54-3995700 
Email:u...@speedy.net 
Website:http://www.speedysoftware.com/uri/en/
 
 
 
 



On Wed, Mar 1, 2017 at 4:15 PM, Jani Tiainen > wrote:


In theory you just define genders to your PO file with
translations and it should work.

Not sure will that disable autogeneration and update for your PO
file after that.

On 01.03.2017 14:59, Gleb Tocarenco wrote:

Hello,

I am running in with an issue with Django translation tag in case
context is present as a dynamic variable.

{%trans 'You have new message' context user.gender %}

In this case django.po files doesn't contains words related to
gender context.

My question is if there is possibility to use context in
translation tag as dynamic variable and generate django.po
records based on it?

-- 
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/5c01a596-23a2-418f-9045-44a947efde0d%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


-- 
Jani Tiainen


-- 
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/269918e9-6e13-5967-3b8b-fc3ec8028a4c%40gmail.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

Re: django-mongo-angularJs

2017-03-02 Thread mohamed shawky
no problem at all 
thanks every where

-- 
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/4ff8420b-ee4e-47bf-ae2d-9332987ab191%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-02 Thread Uri Even-Chen
Hi,

I'm working with Gleb on Speedy Match [
https://github.com/urievenchen/speedy-net]. We need to translate to Hebrew
according to context of the user's gender. Gleb suggested that the code
will be something like this:

{% if user.gender == GENDER_FEMALE %}
{% trans 'This user blocked you.' context 'female' %}
{% elif user.gender == GENDER_MALE  %}
{% trans 'This user blocked you.' context 'male' %}
{% else %}
{% trans 'This user blocked you.' context 'other' %}
{% endif %}


But, is it possible to change it to something like this:

{% trans 'This user blocked you.' context user.gender %}

While still auto-generate the django.po files? Genders are always either
"female", "male" or "other". But some text may be related to genders of 2
users - the one using the site right now and another user. How do we do it
then? I was thinking about context like "female_female", "female_male" etc.
Anyway we don't want the templates to include many times the same text (3
or 9 times), we prefer that each text will appear only once.

Thanks,
Uri.

*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
  
    


On Wed, Mar 1, 2017 at 4:15 PM, Jani Tiainen  wrote:

> In theory you just define genders to your PO file with translations and it
> should work.
>
> Not sure will that disable autogeneration and update for your PO file
> after that.
> On 01.03.2017 14:59, Gleb Tocarenco wrote:
>
> Hello,
>
> I am running in with an issue with Django translation tag in case context
> is present as a dynamic variable.
>
> {% trans 'You have new message' context user.gender %}
>
>
> In this case django.po files doesn't contains words related to gender
> context.
>
> My question is if there is possibility to use context in translation tag
> as dynamic variable and generate django.po records based on it?
>
>
> --
> 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/5c01a596-
> 23a2-418f-9045-44a947efde0d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Jani Tiainen
>
> --
> 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/269918e9-6e13-5967-3b8b-fc3ec8028a4c%40gmail.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/CAMQ2MsG8J0aTnmGoqvVZhDQ9sE5YE3iuZmtqvtYPNgAPiuBPFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Migrations?

2017-03-02 Thread Melvyn Sopacua
On Thursday 02 March 2017 10:45:50 Michal Petrucha wrote:
> On Wed, Mar 01, 2017 at 07:45:24PM -0500, Ed Sutherland wrote:
> > The problem surrounded a textfield that had no default. I added the
> > default string and migrate complained it was an int. I changed the
> > string and migrate still complains of the int default that no longer
> > exists.
> 
> Hi Ed,
> 
> When trying to get help with an error, it's usually helpful to post
> the full traceback that you get when it happens. Otherwise people have
> to do a lot of guessing as to what could have gone wrong, and it just
> takes longer to get all the relevant information out of the question
> asker.

+1. If you've corrected the error and migrations have been applied, I can't 
begin to 
guess why it's still bothering you.

It also matters how you corrected it. If you:
- ran migrate --fake
- created a new migration fixing the error

Then yes, it will still bother you when deploying a new instance. Don't see how 
that 
could bother you on a database that is already migrated though.
-- 
Melvyn Sopacua

-- 
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/2698607.4dLePIk0PE%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: django-mongo-angularJs

2017-03-02 Thread ludovic coues
Sorry, I have no experience with mongodb, I can't help you

2017-03-01 21:12 GMT+01:00 mohamed shawky :
> am using mongodb which the project that i work on it deal with mongo  if you
> can help me thank ou in advance
>
>
> بتاريخ الأربعاء، 1 مارس، 2017 3:43:47 م UTC+2، كتب mohamed shawky:
>>
>> am new in django and mongodb
>> i want to develop a web app contain some
>>  feature like log in
>> and log out and registration and,
>>  update profile and post a text and,
>>  make a comment for this post
>>  ,, front end working with angularJs
>> please help me
>> thank you 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/55793627-f615-4073-b30b-7947bd5b5586%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%2BTbRJA5BF2UMY1_On-7Xvy2QtkFtQNwg08HqK-1fQTeFDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Migrations?

2017-03-02 Thread Michal Petrucha
On Wed, Mar 01, 2017 at 07:45:24PM -0500, Ed Sutherland wrote:
> The problem surrounded a textfield that had no default. I added the
> default string and migrate complained it was an int. I changed the
> string and migrate still complains of the int default that no longer
> exists.

Hi Ed,

When trying to get help with an error, it's usually helpful to post
the full traceback that you get when it happens. Otherwise people have
to do a lot of guessing as to what could have gone wrong, and it just
takes longer to get all the relevant information out of the question
asker.

In this case (and now I'm just guessing, because you haven't provided
a lot of detail in your problem description), it might be that you
have a broken migration in your repository that you'll need to fix. If
that is the case, could you also post the code of the migration file
that is failing?

Cheers,

Michal

-- 
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/20170302094550.GA23772%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: good 404 vs bad 404

2017-03-02 Thread Antonis Christofides
The Django documentation
 explains
it nicely:

[Django] doesn’t bother to email [the admins] for 404s that don’t have a
referer – those are usually just people typing in broken URLs or broken Web
bots.

Antonis Christofides
http://djangodeployment.com

On 03/02/2017 11:13 AM, C Kirby wrote:
> I'd argue that all of the 404s are bad - if your tools are generating broken
> links isn't it better to fix that than to band-aid it with what is a "good" vs
> "bad" 404?
>
> On Thu, Mar 2, 2017 at 11:10 AM, Antonis Christofides
> mailto:anto...@djangodeployment.com>> wrote:
>
> If what you want is locate broken links and ignore 404s resulting from
> emails, then Django's broken link detection functionality
>  is
> probably all that you need, unless you really need to do it in monitoring
> and you can't possibly do it with emails. Ignoring 404s with no referrer
> has been added to 1.9. If I wanted to do this and I was using 1.8 I'd
> probably try to monkey-patch Django with backported code from 1.9.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> http://djangodeployment.com
>
>
> On 03/01/2017 06:21 PM, guettli wrote:
>>
>>
>> Am Mittwoch, 1. März 2017 10:54:38 UTC+1 schrieb Antonis Christofides:
>>
>> My gut feeling says you should treat this in monitoring, however here
>> are some questions:
>>
>> 1) Why do you monitor 404s at all?
>>
>> 2) Could you give some examples of 404s that are valid or should be
>> ignored?
>>
>>
>>
>> I monitor 404 since it this question is about an application which runs
>> only in the intranet.
>>
>> No robots or other strange request come in.
>>
>> 99% of all requests are inside the application.
>>
>> If there is a 404, then it is very likely that our application creates
>> broken links.
>>
>> Since we use reverse() every this is very seldom.
>>
>> Up to now monitoring 404 was nice to have.
>>
>> But now there are some parts where too many 404 responses get returned.
>>
>> Concrete example: we render HTML mails. They often contain broken links.
>> I don't want to report these.
>>
>> Can you understand my use case now? If not, please ask.
>> -- 
>> 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/74679d0f-aa42-4885-8702-c8f6caf6a6bc%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout
>> .
>
> -- 
> 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/Ew7hDj-ELaw/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/172dd6e3-a6a9-145c-4963-063100332cd1%40djangodeployment.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

Re: good 404 vs bad 404

2017-03-02 Thread C Kirby
I'd argue that all of the 404s are bad - if your tools are generating
broken links isn't it better to fix that than to band-aid it with what is a
"good" vs "bad" 404?

On Thu, Mar 2, 2017 at 11:10 AM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> If what you want is locate broken links and ignore 404s resulting from
> emails, then Django's broken link detection functionality
>  is
> probably all that you need, unless you really need to do it in monitoring
> and you can't possibly do it with emails. Ignoring 404s with no referrer
> has been added to 1.9. If I wanted to do this and I was using 1.8 I'd
> probably try to monkey-patch Django with backported code from 1.9.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>  On 03/01/2017 06:21 PM, guettli wrote:
>
>
>
> Am Mittwoch, 1. März 2017 10:54:38 UTC+1 schrieb Antonis Christofides:
>>
>> My gut feeling says you should treat this in monitoring, however here are
>> some questions:
>>
>> 1) Why do you monitor 404s at all?
>>
>> 2) Could you give some examples of 404s that are valid or should be
>> ignored?
>>
>>
> I monitor 404 since it this question is about an application which runs
> only in the intranet.
>
> No robots or other strange request come in.
>
> 99% of all requests are inside the application.
>
> If there is a 404, then it is very likely that our application creates
> broken links.
>
> Since we use reverse() every this is very seldom.
>
> Up to now monitoring 404 was nice to have.
>
> But now there are some parts where too many 404 responses get returned.
>
> Concrete example: we render HTML mails. They often contain broken links.
> I don't want to report these.
>
> Can you understand my use case now? If not, please ask.
> --
> 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/74679d0f-aa42-4885-8702-c8f6caf6a6bc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/Ew7hDj-ELaw/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/172dd6e3-a6a9-145c-4963-063100332cd1%
> 40djangodeployment.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/CAFRq704FmGtr40Km-aX%2Bj09RzWQLmXneDYohm%3D_DbOfCR6whyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-02 Thread Antonis Christofides
If what you want is locate broken links and ignore 404s resulting from emails,
then Django's broken link detection functionality
 is
probably all that you need, unless you really need to do it in monitoring and
you can't possibly do it with emails. Ignoring 404s with no referrer has been
added to 1.9. If I wanted to do this and I was using 1.8 I'd probably try to
monkey-patch Django with backported code from 1.9.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 03/01/2017 06:21 PM, guettli wrote:
>
>
> Am Mittwoch, 1. März 2017 10:54:38 UTC+1 schrieb Antonis Christofides:
>
> My gut feeling says you should treat this in monitoring, however here are
> some questions:
>
> 1) Why do you monitor 404s at all?
>
> 2) Could you give some examples of 404s that are valid or should be 
> ignored?
>
>
>
> I monitor 404 since it this question is about an application which runs only
> in the intranet.
>
> No robots or other strange request come in.
>
> 99% of all requests are inside the application.
>
> If there is a 404, then it is very likely that our application creates broken
> links.
>
> Since we use reverse() every this is very seldom.
>
> Up to now monitoring 404 was nice to have.
>
> But now there are some parts where too many 404 responses get returned.
>
> Concrete example: we render HTML mails. They often contain broken links.
> I don't want to report these.
>
> Can you understand my use case now? If not, please ask.
> -- 
> 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/74679d0f-aa42-4885-8702-c8f6caf6a6bc%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/172dd6e3-a6a9-145c-4963-063100332cd1%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice: django deploy vps error 502

2017-03-02 Thread Antonis Christofides
Your logs contain this:

IOError: write error

However, more information is needed in order to understand what is going on. A
simple "write error" on its own is insufficient—is it a hardware error? Too many
open files? Out of disk space? Something else? If your system writes nothing
else in /var/log/syslog at the time the error occurs, it may be the fault of
uwsgi that it doesn't show more information about the error. Try to increase
error message verbosity, if there is an option to do that.

Incidentally, the reason I migrated from uwsgi to gunicorn a few years ago was
that every once in a while I was having a different problem with uwsgi, which
was taking me hours to solve, largely because of insufficient documentation.
After I switched to gunicorn I never looked back.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 03/01/2017 05:33 PM, carlos wrote:
> Hello, Antonis i have debug = false, yes
> uwsgi dont write anything in the log :/
> When i see the syslog i see error but not understand!
> i share this output
>
> http://pastebin.com/69yvC8Tz
>
> thak for you help
>
> On Wed, Mar 1, 2017 at 12:58 AM, Antonis Christofides
> mailto:anto...@djangodeployment.com>> wrote:
>
> Hello,
>
> 502 usually means the backend isn't running. After you finish the test,
> has the backend stopped running? Does it continue to throw 502s? If that
> is the case, I'm wildly guessing that processes might be growing and
> growing in memory and being eventually killed, but I don't really know. Do
> you have DEBUG = False? Does uwsgi write something in its log? Does the
> system write something in the syslog?
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> http://djangodeployment.com
>
>
> On 02/28/2017 10:49 PM, carlos wrote:
>> Hi, all 
>> i have one vps for one application,
>>
>>  vps description
>>
>> 16GB RAM
>> 8 core processor
>> 160 GB SSD
>> 6TB Transfer
>>
>> ok, i am using, uwsgi(2.0.14), nginx(1.10), mysql(5.6 )and ubuntu 16.04 
>> LTS
>> this site working well when is visited or hits 1k even 6k, but when
>> visited 10k or 12k
>> raiser error 502,
>>
>> When I do a test of ab like these command line
>> ab -k -c 350 -n 2 mydomain.com/ 
>> again raiser the error 502 in almost pages
>>
>> these are configs all, wsgi, nginx
>>
>>  uwsgi script in /etc/uwsgi/app-availabre/website.ini -
>> http://pastebin.com/vQW47WGb
>>
>>  nginx conf in /etc/nginx/nginx.conf  --
>> http://pastebin.com/5BsWWaps
>>
>> - nginx vhost for my website mydpmain 
>> http://pastebin.com/bMPvmrwR
>>
>> How can I do so that the site does not throw the error?
>>
>> Are the settings correct?
>>
>> How can i know the layer support the vps?
>>
>> In nginx how to stop the ab test, if many people do the test the web site
>> throws the error 502 ngixn
>>
>> I would appreciate it if someone gave me an idea or advice to configure
>> better when there is high traffic or are doing ab test or another
>> benchmarking test
>>
>> cheers
>>
>> -- 
>> att.
>> Carlos Rocha
>> -- 
>> 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/CAM-7rO1u-ih5pd9b2AEEDLBJRL7DUvhVDs9hfZjpyGH_fHKJbQ%40mail.gmail.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/7624c177-e769-5fd6-496e-5ab07a927783%40djangodeployment.com
> 
>