Re: How to populate a JqGrid in Django with data obtained from a query (queryset)

2016-09-25 Thread Gergely Polonkai
Hello,

do you already know how to do it without Django, e.g with a static dataset?
Because, from the HTML page's view, you will exactly do that.

I don't know JqGrid, but I assume it needs an array of objects, like

gridData = [
{
firstColumn: 1,
secondColumn: "data"
},
{
firstColumn: 2,
secondColumn:" other data"
}
];

Generate this array from your querysets inside a 

Re: How can I send a password recovery e-mail to a Customer/User in Django?

2016-09-25 Thread Gergely Polonkai
Hello,

the trick is not in the email sending, but in resetting the password.

Assuming you don't use any user managing apps (as you didn't state it), you
will have to implement some parts, but the built-in auth module[1] already
covers a lot of this.

Best,
Gergely

[1]
https://docs.djangoproject.com/en/1.9/topics/auth/default/#using-the-views

On Sun, Sep 25, 2016, 23:17 João Rodrigues  wrote:

> I am working on a small online shop with Django 1.9 and I have a Customers
> page.
>
> Note: This is the back-end site. Only for me...
>
>
> 
>
>
> Clicking on the green lock icon should send a password recovery e-mail to
> the e-mail address of the Customer of that row.
>
> We assume that I can easily fetch the e-mail address of the targeted
> Customer, and that there is no need to check if the e-mail address is
> valid, because it is already in the system.
>
> How could I achieve the action of sending a password recovery e-mail to
> that user?
>
> 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/688c1a12-a7c2-4817-8c26-34ce59ab5c35%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/CACczBUKHmFvqy3U%3D0RZrPZYJWo18dP6k2CyLtkHnfmw19%2B4XVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


email console backend is silent

2016-09-25 Thread Mike Dewhirst
Some little time ago my admin site stopped sending password reset 
emails. After checking all the credentials, ports, server names, etc it 
is still silent.


So in the dev-server I set EMAIL_BACKEND = 
'django.core.mail.backends.console.EmailBackend' and proceeded to 
request a password reset. Nothing was emitted by the dev-server apart 
from ...


Quit the server with CTRL-BREAK.
[26/Sep/2016 09:30:38] "GET /admin/ HTTP/1.1" 302 0
[26/Sep/2016 09:30:38] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 2374
[26/Sep/2016 09:30:40] "GET /admin/password_reset/ HTTP/1.1" 200 1911
[26/Sep/2016 09:30:44] "POST /admin/password_reset/ HTTP/1.1" 302 0
[26/Sep/2016 09:30:44] "GET /admin/password_reset/done/ HTTP/1.1" 200 1784

How do I start debugging this?

Thanks

Mike

EMAIL_HOST = (my ISP's valid, pingable smtp host name)
EMAIL_PORT = 465
EMAIL_HOST_USER = (correct username issued by my ISP)
EMAIL_HOST_PASSWORD = (working password)
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER



--
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/760dd02d-41da-eda9-e602-2c1bd4f2eacf%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: HTML Flexbox CSS

2016-09-25 Thread Mike Dewhirst
Completely off-topic but I have found the CSS documentation and advice 
on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ 
to be more effective and up-to-date than  found on w3schools.


w3schools always sorts to the top of the google page but you will see 
the developer.mozilla item three or four entries below.


ymmv

On 25/09/2016 11:09 PM, Ed09 wrote:

Trying to implement:
http://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_website
within Django.Â
Works fine when all of the Flexbox  section is 
within the template but if I move this style section to a css the 
following @media sections stop working but the rest continues to work.



..
   @media all and (min-width: 600px) {
        .aside { flex: 1 auto; }
    }

    @media all and (min-width: 800px) {
        .main    { flex: 3 0px; }
        .aside1 { order: 1; }
        .main    { order: 2; }
        .aside2 { order: 3; }
        .footer  { order: 4; }
    }


If I implement it as a standard index.html and styles.css pair without 
Django it does work.

Any suggestions?  Thanks for your 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/1b49e8aa-2a31-4673-ab2e-ebce9ab162c9%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/71d34f1b-62f6-d45e-733c-7ba6f6c52255%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


How to populate a JqGrid in Django with data obtained from a query (queryset)

2016-09-25 Thread João Rodrigues
I am working on a small online shop with Django 1.9 and JqGrid

Here is a simplification of my models:

class Addresses(models.Model):
address = models.TextField(db_column='ADDRESS', max_length=2000)
city = models.CharField(db_column='CITY', max_length=400, 
blank=True, null=True)
postal_code = models.CharField(db_column='POSTAL_CODE', 
max_length=200, blank=True, null=True)
state = models.CharField(Country, db_column='STATE', 
max_length=400, blank=True, null=True)
country = models.ForeignKey(Country, db_column='COUNTRY_ID', 
null=True)

class Customers(models.Model):
name = models.CharField(db_column='NAME', max_length=400)
nif = models.CharField(db_column='NIF', max_length=200, null=True, 
blank=True)
email = models.CharField(db_column='EMAIL', max_length=255, 
unique=True)
mobile_number = models.CharField(db_column='MOBILE_NUMBER', 
max_length=200, blank=True, null=True)
phone_number = models.CharField(db_column='PHONE_NUMBER', 
max_length=200, blank=True, null=True)
addresses = models.ManyToManyField(Addresses, 
through='CustomerAddresses')


class CustomerAddresses(models.Model):
id = models.AutoField(db_column='ID', primary_key=True)
address_name = models.CharField(db_column='ADDRESS_NAME', 
max_length=100)
customer = models.ForeignKey(Customers)
address = models.ForeignKey(Addresses)


class Orders(models.Model):
order_number = models.IntegerField(db_column='ORDER_NUMBER', 
unique=True)
customer = models.ForeignKey('Customers', db_column='CUSTOMER_ID')
payment_date = models.DateTimeField(db_column='PAYMENT_DATE', 
blank=True, null=True)
payment_method = models.CharField(db_column='PAYMENT_METHOD', 
max_length=400, blank=True, null=True)
delivery_address = models.ForeignKey('Addresses', 
db_column='ORDER_DELIVERY_ADDRESS_ID', related_name='delivery_address', 
blank=True, null=True)


I want an edit page for a given Customer to look like this:




At the bottom, I want to display grids (JqGrid) inside jQuery tabs.

The Orders grid, should contain all the orders that are associated with the 
current Customer

queryset = Orders.objects.filter(customer=customer_pk)

Idem, for the Addresses.

As you can see, I successfully created the tabs and grid, BUT the grids are 
not filled with the required data (queryset).

Could you help me understand how I should populate the grids with the data 
I want?

I am sorry if this question is not well explained. I am new in Django. If 
there is something you don't understand, please tell me.

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/e7e9b341-f5e3-4010-bb63-78d4bec635ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How can I send a password recovery e-mail to a Customer/User in Django?

2016-09-25 Thread João Rodrigues
I am working on a small online shop with Django 1.9 and I have a Customers 
page.

Note: This is the back-end site. Only for me...




Clicking on the green lock icon should send a password recovery e-mail to 
the e-mail address of the Customer of that row.

We assume that I can easily fetch the e-mail address of the targeted 
Customer, and that there is no need to check if the e-mail address is 
valid, because it is already in the system.

How could I achieve the action of sending a password recovery e-mail to 
that user?

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/688c1a12-a7c2-4817-8c26-34ce59ab5c35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTML Flexbox CSS

2016-09-25 Thread Lekan Wahab
Hi,
In order to ease the work of making your changing your static files to the
right URL format in Django,  a friend of mine came up with a library called
*Staticfy* for it.

You can check it out on :
https://github.com/danidee10/Staticfy

It will really ease your work.

On 25 Sep 2016 2:55 PM, "Ed09"  wrote:

> Trying to implement:
> http://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_website
> within Django.
> Works fine when all of the Flexbox  section is within
> the template but if I move this style section to a css the following @media
> sections stop working but the rest continues to work.
>
> 
> ..
>@media all and (min-width: 600px) {
> .aside { flex: 1 auto; }
> }
>
> @media all and (min-width: 800px) {
> .main{ flex: 3 0px; }
> .aside1 { order: 1; }
> .main{ order: 2; }
> .aside2 { order: 3; }
> .footer  { order: 4; }
> }
> 
>
> If I implement it as a standard index.html and styles.css pair without
> Django it does work.
> Any suggestions?  Thanks for your 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/1b49e8aa-2a31-4673-ab2e-ebce9ab162c9%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/CAE6v7oeKaW9ubxUsbuptt1k-Ndp_B8V9todWahtobKuOPSHTxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTML Flexbox CSS

2016-09-25 Thread ludovic coues
Look like your css isn't loaded.
Static file might be tricky to get right the first time

2016-09-25 15:09 GMT+02:00 Ed09 :
> Trying to implement:
> http://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_website
> within Django.
> Works fine when all of the Flexbox  section is within the
> template but if I move this style section to a css the following @media
> sections stop working but the rest continues to work.
>
> 
> ..
>@media all and (min-width: 600px) {
> .aside { flex: 1 auto; }
> }
>
> @media all and (min-width: 800px) {
> .main{ flex: 3 0px; }
> .aside1 { order: 1; }
> .main{ order: 2; }
> .aside2 { order: 3; }
> .footer  { order: 4; }
> }
> 
>
> If I implement it as a standard index.html and styles.css pair without
> Django it does work.
> Any suggestions?  Thanks for your 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/1b49e8aa-2a31-4673-ab2e-ebce9ab162c9%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%2BTbV1ksXFZobUAa6uj2UZAdH64BiByzpKHDxcbdOvrnFHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


HTML Flexbox CSS

2016-09-25 Thread Ed09
Trying to implement:
http://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_website
within Django.  
Works fine when all of the Flexbox  section is within 
the template but if I move this style section to a css the following @media 
sections stop working but the rest continues to work.


..
   @media all and (min-width: 600px) {
.aside { flex: 1 auto; }
}

@media all and (min-width: 800px) {
.main{ flex: 3 0px; }
.aside1 { order: 1; } 
.main{ order: 2; }
.aside2 { order: 3; }
.footer  { order: 4; }
}


If I implement it as a standard index.html and styles.css pair without 
Django it does work.
Any suggestions?  Thanks for your 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/1b49e8aa-2a31-4673-ab2e-ebce9ab162c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: nginx configuration to cache all endpoints but one

2016-09-25 Thread gg4u
Hi M :)

thank you for helping out!
Here a .txt version of settings.

For logs, I will send it in PVT!

thank you.

Il giorno domenica 25 settembre 2016 13:40:13 UTC+2, M Hashmi ha scritto:
>
> Send me settings of /etc/nginx/nginx.conf and then 
> /etc/sites-available/app.
> The format of the file is not opening up on my system as I am on windows 
> right now.
>
> Also if you have some logs that would be great. 
> Regards,
> M (call me M)
>
> On Sun, Sep 25, 2016 at 3:50 AM, gg4u  
> wrote:
>
>> Hi Hashmi,
>>
>> thank you for your suggestion.
>>
>> I tried to set proxy_pass for the location I don't want to cache, but I 
>> don't see caching working properly on my browser.
>>
>> Could you give a look?
>> I will attach a mockup of settings,may you want to comment or edit it 
>> there so that is more readable to me and also other people?
>>
>> I want to cache all /api location, except /api/search
>>
>> In attachment what I tried (I removed from settings things not relevant 
>> to this).
>>
>> thank you,
>> Luigi
>>
>>
>>
>>
>>
>> Il giorno venerdì 23 settembre 2016 21:45:45 UTC+2, M Hashmi ha scritto:
>>>
>>> Create a separate block to exclude certain endpoint above others. 
>>>
>>> You can also try following approach.
>>>
>>> https://groups.google.com/forum/embed/#!topic/openresty-en/apyaHbqJetU
>>> Regrads,
>>> Mudassar
>>>
>>> On Fri, Sep 23, 2016 at 12:26 PM, gg4u  wrote:
>>>
 Hello,

 I want to cache all api endpoints except of one: /api/search endpoint.
 Do I need to specify settings for each of the endpoints?

 My configuration use nginx as server on port 8000 and port 80 as 
 virtual proxy server.
 Please not I removed settings not related to question to minify the 
 post!

 server {
 listen 8000 default_server;

 # Set Cache for my Json api
 # I want to cache everything but /api/search endpoint
 location ~* \.(?:json)$ {
  expires 1M;
  access_log off;
  add_header Cache-Control "public";
 }


 location /api {
 include uwsgi_params;
 uwsgi_pass unix:/var/www/awesome3-gamma/app.sock;
 allow [MY DNS];
 deny all;
 }
 }



 # Set cache dir
 proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m 
 inactive=60m;
 proxy_cache_key "$scheme$request_method$host$request_uri";

 # Virtualhost/server configuration
 server {
 listen   80  default_server;

 # here I cache /api
 # how to avoid caching /api/search ?
 
 location /api {
 add_header X-Proxy-Cache $upstream_cache_status;
 proxy_cache my_zone;
 proxy_cache_use_stale updating;
 proxy_cache_lock on;
 proxy_cache_valid 30d;
 proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
   proxy_pass [my site route api]
 }
 }


 I am looking at:

 http://stackoverflow.com/questions/29466494/nginx-turn-off-cache-for-a-specific-file

 http://stackoverflow.com/questions/29466494/nginx-turn-off-cache-for-a-specific-file

 tried with following block on server listening on port 8000

 location /api/search {
 expires off;
 }


 but got error 500.

 Must it go before /api location, afterwards, or it does not matter the 
 order?
 Any idea of what I am missing ?

 I would like to avoid specify same settings for all API endpoints

 -- 
 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/2a459135-89fa-45d5-8b4e-79b5377c11a8%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...@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/d0ec5cdd-7fb0-43e5-aaa6-5922fd266c36%40googlegroups.com
>>  
>> 
>> .
>>
>> For 

Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Lekan Wahab
On 25 Sep 2016 1:17 PM, "kbman99"  wrote:

>

> Just getting started with django and having an issue with the migrate.py
script. It generates a db.SQLite3 file which is filled with a lot of
garbage characters. It's in UTF-8 encoding, but looks like this.
>
> I've deleted the file and redone the migrate a few times but it's always
like this.
>
> Any help appreciated!
> 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/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com

.
> For more options, visit https://groups.google.com/d/optout.
Hi kbman,
If you use PyCharm, you can easily read the sqlite3 file better with its
database integration.
Click on database.
Select from sources and then okay.

Lekan.

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


Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Gergely Polonkai
That file is an SQLite database, which is a binary format. It should look
like this.

I know it is confusing, because of that bunch of SMS statements, but it's
OK that way. If you want to interact with it, use the sqlite3 command, or
an SQLite GUI.

On Sun, Sep 25, 2016, 14:17 kbman99  wrote:

> Just getting started with django and having an issue with the migrate.py
> script. It generates a db.SQLite3 file which is filled with a lot of
> garbage characters. It's in UTF-8 encoding, but looks like this.
>
> 
> I've deleted the file and redone the migrate a few times but it's always
> like this.
>
> Any help appreciated!
> 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/2980ce12-c366-454b-844a-c625e7520977%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/CACczBU%2BLjg8hzYKKEKEdec9kWdWS1bfXSCdX0qsO0oxcppVX5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread kbman99
Just getting started with django and having an issue with the migrate.py 
script. It generates a db.SQLite3 file which is filled with a lot of 
garbage characters. It's in UTF-8 encoding, but looks like this.


I've deleted the file and redone the migrate a few times but it's always 
like this.

Any help appreciated!
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/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: nginx configuration to cache all endpoints but one

2016-09-25 Thread M Hashmi
Send me settings of /etc/nginx/nginx.conf and then /etc/sites-available/app.
The format of the file is not opening up on my system as I am on windows
right now.

Also if you have some logs that would be great.
Regards,
M (call me M)

On Sun, Sep 25, 2016 at 3:50 AM, gg4u  wrote:

> Hi Hashmi,
>
> thank you for your suggestion.
>
> I tried to set proxy_pass for the location I don't want to cache, but I
> don't see caching working properly on my browser.
>
> Could you give a look?
> I will attach a mockup of settings,may you want to comment or edit it
> there so that is more readable to me and also other people?
>
> I want to cache all /api location, except /api/search
>
> In attachment what I tried (I removed from settings things not relevant to
> this).
>
> thank you,
> Luigi
>
>
>
>
>
> Il giorno venerdì 23 settembre 2016 21:45:45 UTC+2, M Hashmi ha scritto:
>>
>> Create a separate block to exclude certain endpoint above others.
>>
>> You can also try following approach.
>>
>> https://groups.google.com/forum/embed/#!topic/openresty-en/apyaHbqJetU
>> Regrads,
>> Mudassar
>>
>> On Fri, Sep 23, 2016 at 12:26 PM, gg4u  wrote:
>>
>>> Hello,
>>>
>>> I want to cache all api endpoints except of one: /api/search endpoint.
>>> Do I need to specify settings for each of the endpoints?
>>>
>>> My configuration use nginx as server on port 8000 and port 80 as virtual
>>> proxy server.
>>> Please not I removed settings not related to question to minify the post!
>>>
>>> server {
>>> listen 8000 default_server;
>>>
>>> # Set Cache for my Json api
>>> # I want to cache everything but /api/search endpoint
>>> location ~* \.(?:json)$ {
>>>  expires 1M;
>>>  access_log off;
>>>  add_header Cache-Control "public";
>>> }
>>>
>>>
>>> location /api {
>>> include uwsgi_params;
>>> uwsgi_pass unix:/var/www/awesome3-gamma/app.sock;
>>> allow [MY DNS];
>>> deny all;
>>> }
>>> }
>>>
>>>
>>>
>>> # Set cache dir
>>> proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m
>>> inactive=60m;
>>> proxy_cache_key "$scheme$request_method$host$request_uri";
>>>
>>> # Virtualhost/server configuration
>>> server {
>>> listen   80  default_server;
>>>
>>> # here I cache /api
>>> # how to avoid caching /api/search ?
>>>
>>> location /api {
>>> add_header X-Proxy-Cache $upstream_cache_status;
>>> proxy_cache my_zone;
>>> proxy_cache_use_stale updating;
>>> proxy_cache_lock on;
>>> proxy_cache_valid 30d;
>>> proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
>>>   proxy_pass [my site route api]
>>> }
>>> }
>>>
>>>
>>> I am looking at:
>>> http://stackoverflow.com/questions/29466494/nginx-turn-off-
>>> cache-for-a-specific-file
>>> http://stackoverflow.com/questions/29466494/nginx-turn-off-
>>> cache-for-a-specific-file
>>>
>>> tried with following block on server listening on port 8000
>>>
>>> location /api/search {
>>> expires off;
>>> }
>>>
>>>
>>> but got error 500.
>>>
>>> Must it go before /api location, afterwards, or it does not matter the
>>> order?
>>> Any idea of what I am missing ?
>>>
>>> I would like to avoid specify same settings for all API endpoints
>>>
>>> --
>>> 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/ms
>>> gid/django-users/2a459135-89fa-45d5-8b4e-79b5377c11a8%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/d0ec5cdd-7fb0-43e5-aaa6-5922fd266c36%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 

Can someone help me to fix ForeignKey related filter issues

2016-09-25 Thread Shazia Nusrat
Hi,

Following is the link and kindly assist as I've been trying to do this for
hours now.

http://stackoverflow.com/questions/39685833/django-filter-with-foreignkey-not-working?noredirect=1#comment66671635_39685833

Regards,
Shazia

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


ForeignKey filters are not working

2016-09-25 Thread Shazia Nusrat
Hi,
Can someone please help me with the question in link.

I've been trying to get it done from hours now please assist to get my
processed orders displayed on dashboard.

Regards,
Shazia

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


Re: nginx configuration to cache all endpoints but one

2016-09-25 Thread gg4u
Hi Hashmi,

thank you for your suggestion.

I tried to set proxy_pass for the location I don't want to cache, but I 
don't see caching working properly on my browser.

Could you give a look?
I will attach a mockup of settings,may you want to comment or edit it there 
so that is more readable to me and also other people?

I want to cache all /api location, except /api/search

In attachment what I tried (I removed from settings things not relevant to 
this).

thank you,
Luigi





Il giorno venerdì 23 settembre 2016 21:45:45 UTC+2, M Hashmi ha scritto:
>
> Create a separate block to exclude certain endpoint above others. 
>
> You can also try following approach.
>
> https://groups.google.com/forum/embed/#!topic/openresty-en/apyaHbqJetU
> Regrads,
> Mudassar
>
> On Fri, Sep 23, 2016 at 12:26 PM, gg4u  
> wrote:
>
>> Hello,
>>
>> I want to cache all api endpoints except of one: /api/search endpoint.
>> Do I need to specify settings for each of the endpoints?
>>
>> My configuration use nginx as server on port 8000 and port 80 as virtual 
>> proxy server.
>> Please not I removed settings not related to question to minify the post!
>>
>> server {
>> listen 8000 default_server;
>>
>> # Set Cache for my Json api
>> # I want to cache everything but /api/search endpoint
>> location ~* \.(?:json)$ {
>>  expires 1M;
>>  access_log off;
>>  add_header Cache-Control "public";
>> }
>>
>>
>> location /api {
>> include uwsgi_params;
>> uwsgi_pass unix:/var/www/awesome3-gamma/app.sock;
>> allow [MY DNS];
>> deny all;
>> }
>> }
>>
>>
>>
>> # Set cache dir
>> proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
>> proxy_cache_key "$scheme$request_method$host$request_uri";
>>
>> # Virtualhost/server configuration
>> server {
>> listen   80  default_server;
>>
>> # here I cache /api
>> # how to avoid caching /api/search ?
>> 
>> location /api {
>> add_header X-Proxy-Cache $upstream_cache_status;
>> proxy_cache my_zone;
>> proxy_cache_use_stale updating;
>> proxy_cache_lock on;
>> proxy_cache_valid 30d;
>> proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
>>   proxy_pass [my site route api]
>> }
>> }
>>
>>
>> I am looking at:
>>
>> http://stackoverflow.com/questions/29466494/nginx-turn-off-cache-for-a-specific-file
>>
>> http://stackoverflow.com/questions/29466494/nginx-turn-off-cache-for-a-specific-file
>>
>> tried with following block on server listening on port 8000
>>
>> location /api/search {
>> expires off;
>> }
>>
>>
>> but got error 500.
>>
>> Must it go before /api location, afterwards, or it does not matter the 
>> order?
>> Any idea of what I am missing ?
>>
>> I would like to avoid specify same settings for all API endpoints
>>
>> -- 
>> 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/2a459135-89fa-45d5-8b4e-79b5377c11a8%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/d0ec5cdd-7fb0-43e5-aaa6-5922fd266c36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


test-caching
Description: Binary data