Re: learn dijango

2018-07-26 Thread Gerald Brown
The best way to learn Django is to jump in and start using it. If you 
have problems there are many tutorials and web sites (including this 
one) to provide help and support.


IMHO, a teacher CANNOT teach a student, all they can do is HELP the 
student learn.



On Thursday, 26 July, 2018 01:55 PM, arul wrote:
*I just entered the programming world and i know little bit 
javascript,HTML can learn even I don't  know any oop/scripting 
language can I learn django for now is there any possibility*


--
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/6a647470-b7e2-49a9-b323-6d820f4843d2%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/df439168-89b2-a1cd-3785-97932f70dacb%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Optimizing Prefetch for Postgres IN Limit

2018-07-26 Thread Ram J
Hi Xof,

The issue is that, when you do a naive Prefetch you are left with nothing
but Django’s auto generated IN query. I was asking about he recommended way
to make this into a JOIN, which is not obvious how to do with Django

Also in my case the naive IN query on the PK *did not* generate a Index
scan and ended up being a full table scan

I could have however used a Prefetch object to force PG to use a different
index apart from the PK but a naive Prefetch of the form
queryset.prefetch(‘table__table2’) does not use any index beyond 100 values

Also it’s hard to estimate how many values will be there in a nested
 prefetch, to state the obvious, to do anything different on a query by
query basis


On Thu, Jul 26, 2018 at 19:35 Christophe Pettus  wrote:

>
> > On Jul 25, 2018, at 02:59, Jason  wrote:
> >
> > Where do you get that in the pg documentation? I can't find that
> anywhere (google-fu may be failing me), and we do have some queries with
> more than 100 values using IN.
>
> It's slightly more complicated than that.  Above 100 entries, the
> PostgreSQL optimizer won't try to do optimizations of the form changing i
> IN (1, 2 ..., 101) to (i = 1) OR (i = 2) OR  (i = 3)... to see if there's a
> better way of executing the query.  It *can* still do an index scan in
> those cases, although the more entries in the IN list, the less efficient
> that will be.  In general, large IN clauses aren't a great idea; they're
> better replaced with a join.
>
> --
> -- Christophe Pettus
>x...@thebuild.com
>
> --
> 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/y9sVr9Pbr-o/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/8A21227D-94A9-459F-89D0-771D3052C0C0%40thebuild.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/CAAW8NzkO4afBsP11yF1SbJq2EZsSBiWhAwSma7QZd%2BtCQULHjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-26 Thread Ashish Kumar
I'm using the latest version m8

On Wednesday, July 25, 2018 at 5:50:24 PM UTC+5:30, Okware Aldo wrote:
>
> I think he should share screenshot of his setting.py file, but from what I 
> can see -- if he is running django 1.10 and above apps should be 'polls' 
> not  *'polls.apps.PollsConfig'* 
>
> On Wed, Jul 25, 2018 at 2:23 PM theAloneOne  > wrote:
>
>> You may have missed a comma after *'polls.apps.PollsConfig'* in your 
>> settings.py file in the *INSTALLED_APPS* list so check it again and you 
>> may not be using the same django-version as used in documentation so get 
>> the latest if you are following latest docs release.
>>
>> -- 
>> 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/f10762a5-d1b4-442c-aea0-a455e3925b71%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/2d45acf0-cf39-4816-8d88-638a2a82f031%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-26 Thread Ashish Kumar
thanks man. that was the mistake i did.

On Wednesday, July 25, 2018 at 4:54:09 PM UTC+5:30, theAloneOne wrote:
>
> You may have missed a comma after *'polls.apps.PollsConfig'* in your 
> settings.py file in the *INSTALLED_APPS* list so check it again and you 
> may not be using the same django-version as used in documentation so get 
> the latest if you are following latest docs release.
>

-- 
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/d10ff2ad-a54f-4542-87e1-6e2eb560e0ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Optimizing Prefetch for Postgres IN Limit

2018-07-26 Thread Christophe Pettus


> On Jul 25, 2018, at 02:59, Jason  wrote:
> 
> Where do you get that in the pg documentation? I can't find that anywhere 
> (google-fu may be failing me), and we do have some queries with more than 100 
> values using IN.

It's slightly more complicated than that.  Above 100 entries, the PostgreSQL 
optimizer won't try to do optimizations of the form changing i IN (1, 2 ..., 
101) to (i = 1) OR (i = 2) OR  (i = 3)... to see if there's a better way of 
executing the query.  It *can* still do an index scan in those cases, although 
the more entries in the IN list, the less efficient that will be.  In general, 
large IN clauses aren't a great idea; they're better replaced with a join.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
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/8A21227D-94A9-459F-89D0-771D3052C0C0%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


[Question] Django 2 - how to sum values based on filter and group by Year-Month

2018-07-26 Thread Charles Sartori
I have the following table:

2018-01-01  10
2018-01-15  20
2018-01-31  30
2018-02-01  10
2018-03-01  10
2018-03-20  20

I need to Sum() the values filtering it with 
1 - sum(values) where date < first day of the month
2 - sum(values) where date < last day of the month

Expected result(something like that):
[
 {'year-month': '2018-01'}, {'sum_before_month_day_one': *0*}, 
{'sum_before_last_month_day': *60*},
 {'year-month': '2018-02'}, {'sum_before_month_day_one': *60*}, 
{'sum_before_last_month_day': *70*},
 {'year-month': '2018-03'}, {'sum_before_month_day_one': *70*}, 
{'sum_before_last_month_day': *100*},
]

So far I manage to sum values and group by month:

In [12]: result = Sale.objects \
...: .annotate(date=TruncMonth('event_date')) \
...: .values('date') \
...: .annotate(quantity=Sum('quantity')) \
...: .values('date', 'quantity') \
...: .order_by('date')

In [13]: for i in result: print(i)

{'date': datetime.date(2018, 1, 1), 'quantity': 60.0}
{'date': datetime.date(2018, 2, 1), 'quantity': 10.0}
{'date': datetime.date(2018, 3, 1), 'quantity': 30.0}

-- 
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/a57a7058-ea08-4909-8e98-c678aa9969cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Hiroyuki Yamashita
Ohh.It's lacked my confirmation.
Thanks guys.

On Friday, July 27, 2018 at 1:00:05 AM UTC+9, Tim Graham wrote:
>
> This is a regression that will be fixed in Django 2.0.8: 
> https://code.djangoproject.com/ticket/29544
>
> On Thursday, July 26, 2018 at 6:40:37 AM UTC-4, Jason wrote:
>>
>> what's the django orm code that generates that query?
>>
>> On Thursday, July 26, 2018 at 12:12:06 AM UTC-4, Hiroyuki Yamashita wrote:
>>>
>>> My name is Hiroyuki Yamashia. 
>>>
>>> Create SQL query function is wrong by Django2.0.7. 
>>>
>>> I using MariaDB and using "__regex". 
>>>
>>> Django2.0.7 is generate this SQL query. 
>>>
>>> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
>>> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 225 AND 
>>> `scanner_tmpresponse_07`.`deleted` = False AND 
>>> `scanner_tmpresponse_07`.`disabled` = False AND 
>>> REGEXP_LIKE(`scanner_tmpresponse_07`.`response_body`, 
>>> .*192\.168\.\d+\.\d+.*, 'c')) ORDER BY `scanner_tmpresponse_07`.`id` 
>>> ASC 
>>>
>>> I think "REGEXP_LIKE" is Oracle function for Regular expression. 
>>>
>>> Django2.0.6 is generate this SQL query. 
>>> This version is no problem. 
>>>
>>> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
>>> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 224 AND 
>>> `scanner_tmpresponse_07`.`deleted` = False AND 
>>> `scanner_tmpresponse_07`.`disabled` = False AND 
>>> `scanner_tmpresponse_07`.`response_body` REGEXP BINARY 
>>> .*192\.168\.\d+\.\d+.*) ORDER BY `scanner_tmpresponse_07`.`id` ASC 
>>>
>>>
>>> #- 
>>> settings.py 
>>>
>>> DATABASES = { 
>>> 'default': { 
>>> 'ENGINE': 'django.db.backends.mysql', 
>>> 'NAME' : 'XXX', 
>>> 'HOST' : 'localhost', 
>>> 'USER' : '', 
>>> 'PASSWORD' : 'X', 
>>> 'PORT' : '3306', 
>>> #'ATOMIC_REQUESTS':True, 
>>>
>>> }, 
>>> 'scanner': { 
>>> 'ENGINE': 'django.db.backends.mysql', 
>>> 'NAME' : 'XXX', 
>>> 'HOST' : 'localhost', 
>>> 'USER' : '', 
>>> 'PASSWORD' : 'X', 
>>> 'PORT' : '3306', 
>>> #'ATOMIC_REQUESTS':True, 
>>>
>>> }, 
>>> 'portal': { 
>>> 'ENGINE': 'django.db.backends.mysql', 
>>> 'NAME' : 'XXX', 
>>> 'HOST' : 'localhost', 
>>> 'USER' : '', 
>>> 'PASSWORD' : 'X', 
>>> 'PORT' : '3306', 
>>> #'ATOMIC_REQUESTS':True, 
>>> } 
>>> } 
>>>
>>> #- 
>>>
>>> Traceback (most recent call last): 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/utils.py",
>>>  
>>>
>>> line 85, in _execute 
>>> return self.cursor.execute(sql, params) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/mysql/base.py",
>>>  
>>>
>>> line 71, in execute 
>>> return self.cursor.execute(query, args) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>>  
>>>
>>> line 250, in execute 
>>> self.errorhandler(self, exc, value) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>>>  
>>>
>>> line 50, in defaulterrorhandler 
>>> raise errorvalue 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>>  
>>>
>>> line 247, in execute 
>>> res = self._query(query) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>>  
>>>
>>> line 412, in _query 
>>> rowcount = self._do_query(q) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>>  
>>>
>>> line 375, in _do_query 
>>> db.query(q) 
>>>
>>>   File 
>>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>>>  
>>>
>>> line 276, in query 
>>> _mysql.connection.query(self, query) 
>>>
>>> _mysql_exceptions.OperationalError: (1305, 'FUNCTION 
>>> scanner.REGEXP_LIKE does not exist') 
>>>
>>>
>>> The above exception was the direct cause of the following exception: 
>>>
>>>
>>> -- 
>>> == 
>>> Hiroyuki Yamashita 山下 裕之 
>>> == 
>>>
>>

-- 
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/85f66ec9-b2a2-409a-8090-1e5e4ea28410%40googlegroups.com.
For more options, visit 

Django App plugins

2018-07-26 Thread Christian González
Hello,

I'm asking myself since a while how to create a Django app with plugins.
I mean an extensible application that can be extended by plugins from an
"app store". I did a lot of research on that, and it's not easy to
manage it.

I'm doing that using partly the REST framework for an API, and graphene
for primary communication from the (Vue) client to the server, Django
channels for communication from server to client.

The plugins must be able to:

* have own models
* have own code that plunges into existing hooks (already done using a
plugin system)
* have own URLs
* have own Graphene Schema (works using plugin system)
* have own REST serializers (should work using my plugin system)
* etc.

The main problem is that dynamic loading of Django APPS  is not really
possible since Django somewhat 1.7-1.9 with the new loading system. So
everything that stands in settings.py is frozen after Django has started.

Apps that are downloaded after that and inserted into the system, are
"ignored" by Django core.

What I did so far: I made a PluginManager with a middleware that
dynamically searches a plugin directory for "apps", and adds their
Appconfig to django.apps. That does not really work well.

Is there a better possibility? Sure, I can make a custom format for
plugins, but I'd like NOT to reinvent Django's wheel and create
boilerplate code for loading models, migrations, schemas, admin parts,
etc. again when django apps do that already.

Has anyone created an application that dynamically loads code AFTER
Django start, with Django 2.0+?

If you'd like to see some code, have a look at
https://gitlab.com/nerdocs/medux/MedUX/tree/develop (the develop
branch), mostly at medux/extensionsystem/pluginmanager.py

I know all the stackexchange questions about dynamically loading code,
but that all only works for earlier Django versions.

Any help/hints welcome.

-- 

Dr. Christian González
https://www.nerdocs.at
+43 650 7644477


-- 
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/e5bc37d4-88ef-5f51-f4c5-758ba9bfa995%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.


Re: find difference of dates between today and filter list[dates]

2018-07-26 Thread Deepak Madan Singh
Great help; Thanks Derek

On Thu, Jul 26, 2018 at 8:30 PM, Derek  wrote:

> Here's a created list of dates (before and after today) and a way to
> calculate the offset days relative to today ("now") and alert at a set
> interval:
>
> from __future__ import print_function
> import datetime
>
> now = datetime.datetime.now()
> dates = []
> for d in range(7, 0, -1):
> dates.append(datetime.datetime.now() - datetime.timedelta(days=d))
> for d in range(1, 8):
> dates.append(datetime.datetime.now() + datetime.timedelta(days=d))
> for _date in dates:
> diff = _date - now
> print(_date.strftime('%Y%m%d'), diff.days)
> if diff.days == 3:
> print('Alert @ 3 days!')
>
>
> On Wednesday, 25 July 2018 21:12:54 UTC+2, deepak madan wrote:
>>
>> HOW to find the difference between a list of dates and today and find the
>> difference matches some days difference. 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/146e56b9-31b6-4fa4-9c08-4947dd75a087%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/CAMwf7ZD1%3D--%2BwLeHhJ%2Bt8f8X7LA84xHfo9RRB%3D7CdR_5ZPESAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to find activities dues for today and tommorow

2018-07-26 Thread Deepak Madan Singh
Thank you Julio :)

On Thu, Jul 26, 2018 at 12:53 AM, Julio Biason 
wrote:

> Hi Deepak,
>
> You could set up another model to track when something should be done to
> the tree; something like this:
>
> class Tree(models.Model):
> ...
> planted_date = models.DateField()
>
> class Reminder(models.Model):
> tree = models.ForeignKey(tree)
> when = models.DateField()
> what = models.CharField()
> done = models.BooleanField()
>
> So, when you create a tree, you get the current date and create the
> entries on the Reminder model. Somewhere, you can get the list of reminders
> with something like
>
> to_do = Reminder.object.filter(Q(tree=tree_in_view) &
> Q(when_lte=datetime.datetime.today()) & Q(done_ne=True))
>
> And throw this in the view -- it basically says "give me all the reminders
> for the tree I'm looking at in this point (say, you have a page for each
> tree, so this is the tree id), in which the reminder is from a date equal
> or before today (in case you don't want to show reminders for dates in the
> future) and which are not done (which you should also provide a way so the
> user can mark the reminder as "done" and not be bothered with it again).
>
> You can find more information about the Q here:
> https://docs.djangoproject.com/en/2.0/topics/db/queries/#
> complex-lookups-with-q-objects
>
> On Wed, Jul 25, 2018 at 3:07 PM, deepak madan 
> wrote:
>
>> suppose a model for the tree which is planted on some days. The second
>> model has activities dues to be done after some regular interval like 1)
>> giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
>> My question is when this 5th or 15th days arrives, to design a reminder
>> page to show activities dues today and tomorrow.
>>
>> Please help
>> Whats logic in views.py
>>
>> --
>> 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/ms
>> gid/django-users/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101   |  Mobile: +55 51
> *99907 0554*
>
> --
> 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/CAEM7gE2TpCpVB8MKb6Yu_uiKSpNc%3DZRxYk5vs-q6aKaG-c8zZA%
> 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/CAMwf7ZAJhp2xgKmVs2%2BFbveYmLfAa6FDQedG3mrXhej-%3D2g6vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Code review

2018-07-26 Thread Kasper Laudrup

Hi fellow Django users,

I've used Django to create a simple website for a summerhouse I have 
with my family.


I'm not very experienced with Django, but is has been a real pleasure 
working with this framework and I don't really have any issues, but it 
would be nice if someone more experienced than me would have a look at 
my code and point out any obvious mistakes, smarter ways to do things or 
really, anything else.


The code is here:

https://github.com/laudrup/ebbamaala

Any input is welcome.

Thanks a lot.

Kind regards,

Kasper Laudrup

--
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/b56b5440-d673-7bd1-c92c-8b733a542741%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Prevent Django tests from accessing internet (except localhost)

2018-07-26 Thread Melvyn Sopacua
On donderdag 26 juli 2018 02:35:01 CEST Gene wrote:
> Preventing code from using networking is a common approach for unit tests
> Firewall is a completely different story and has nothing common with this
> matter

It does, because he's looking for a catch-all  button. If you read the entire 
thread you'll see we've offered several times, several strategies for 
different approaches for unit tests.

But he's looking for the equivalent of  "turning off the main water line" - 
and that's a firewall or sandboxes / virtual machines without network routing.

Django has absolutely no way to do that and cannot, because there's no telling 
what 3rd party apps do (not that python has such a switch or even C).

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


Problem with sending django channels event from models

2018-07-26 Thread luan fonceca
Hello, i'm trying to implement a "post_save" signal wherever some user are 
update. I setup everything by following the documentation and some 
tutorials for Channels 2. I wrote a test using "py.test" to assert that 
everything is working as expected but i'm getting a exception 

.

On this link i have posted a gist. 


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/3f42ad5c-c737-4a5e-baad-54023261d7f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Change the default route of a view

2018-07-26 Thread Fernando Miranda
Hello, I'm using Django Rest Framework, I was wondering if you have how to 
change the default url of an endpoint in a view? In case it is a view of 
account where I wanted the retrieve method to be without / {id} this also 
for the delete and edit because I will identify the user by the token 
passed in the header.

-- 
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/cfcef28c-12b3-4fb6-8c8e-1a6d424bd98e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: avoiding import-time queries

2018-07-26 Thread Julio Biason
Hi Clarvierplayer,

Dunno if that's a best practice, but I'd add a module in the same app with
functions to retrieve the information and use cache (
https://docs.djangoproject.com/en/2.0/topics/cache/#basic-usage) copiously.
So, instead of loading the values at start up time, the values would be
filled only after the first time it was requested.

On Thu, Jul 26, 2018 at 3:21 PM,  wrote:

> I'm looking for some best-practice (or at least workable) suggestions for
> avoiding import-time queries. I have some database records that are
> constant, and these constants are used all over the application. Is there
> any way to get those constants out of the database once at startup?
>
> At present, I am working on a set of apps with a single underlying
> database. And they wouldn't build at all when I tried to migrate a new test
> database because of import-time queries, because it wants to validate the
> references to those constants at build time (and can't, because in this
> case my new test database has no tables yet). Is there any way to store
> these model records in something that will persist between builds (kind of
> like test fixtures)? A StackOverflow discussion
> 
>  suggested
> the Python Lazy Object Proxy, but that project appears to have been
> abandoned. The Django docs themselves simply recommend avoiding
> query-at-import behaviors--I can definitely see it causes all kinds of
> problems that are not easy to circumvent--but they make no recommendations
> for alternatives. Is it indeed necessary to keep querying for these all
> over the app? Is there a third-party solution that I've overlooked?
>
> Django 2.0. Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/9510552d-9afe-47b0-842e-6f80e9a28bbe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


avoiding import-time queries

2018-07-26 Thread clavierplayer
I'm looking for some best-practice (or at least workable) suggestions for 
avoiding import-time queries. I have some database records that are 
constant, and these constants are used all over the application. Is there 
any way to get those constants out of the database once at startup? 

At present, I am working on a set of apps with a single underlying 
database. And they wouldn't build at all when I tried to migrate a new test 
database because of import-time queries, because it wants to validate the 
references to those constants at build time (and can't, because in this 
case my new test database has no tables yet). Is there any way to store 
these model records in something that will persist between builds (kind of 
like test fixtures)? A StackOverflow discussion 

 suggested 
the Python Lazy Object Proxy, but that project appears to have been 
abandoned. The Django docs themselves simply recommend avoiding 
query-at-import behaviors--I can definitely see it causes all kinds of 
problems that are not easy to circumvent--but they make no recommendations 
for alternatives. Is it indeed necessary to keep querying for these all 
over the app? Is there a third-party solution that I've overlooked?

Django 2.0. Thank you!

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


Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Tim Graham
This is a regression that will be fixed in Django 2.0.8: 
https://code.djangoproject.com/ticket/29544

On Thursday, July 26, 2018 at 6:40:37 AM UTC-4, Jason wrote:
>
> what's the django orm code that generates that query?
>
> On Thursday, July 26, 2018 at 12:12:06 AM UTC-4, Hiroyuki Yamashita wrote:
>>
>> My name is Hiroyuki Yamashia. 
>>
>> Create SQL query function is wrong by Django2.0.7. 
>>
>> I using MariaDB and using "__regex". 
>>
>> Django2.0.7 is generate this SQL query. 
>>
>> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
>> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 225 AND 
>> `scanner_tmpresponse_07`.`deleted` = False AND 
>> `scanner_tmpresponse_07`.`disabled` = False AND 
>> REGEXP_LIKE(`scanner_tmpresponse_07`.`response_body`, 
>> .*192\.168\.\d+\.\d+.*, 'c')) ORDER BY `scanner_tmpresponse_07`.`id` 
>> ASC 
>>
>> I think "REGEXP_LIKE" is Oracle function for Regular expression. 
>>
>> Django2.0.6 is generate this SQL query. 
>> This version is no problem. 
>>
>> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
>> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 224 AND 
>> `scanner_tmpresponse_07`.`deleted` = False AND 
>> `scanner_tmpresponse_07`.`disabled` = False AND 
>> `scanner_tmpresponse_07`.`response_body` REGEXP BINARY 
>> .*192\.168\.\d+\.\d+.*) ORDER BY `scanner_tmpresponse_07`.`id` ASC 
>>
>>
>> #- 
>> settings.py 
>>
>> DATABASES = { 
>> 'default': { 
>> 'ENGINE': 'django.db.backends.mysql', 
>> 'NAME' : 'XXX', 
>> 'HOST' : 'localhost', 
>> 'USER' : '', 
>> 'PASSWORD' : 'X', 
>> 'PORT' : '3306', 
>> #'ATOMIC_REQUESTS':True, 
>>
>> }, 
>> 'scanner': { 
>> 'ENGINE': 'django.db.backends.mysql', 
>> 'NAME' : 'XXX', 
>> 'HOST' : 'localhost', 
>> 'USER' : '', 
>> 'PASSWORD' : 'X', 
>> 'PORT' : '3306', 
>> #'ATOMIC_REQUESTS':True, 
>>
>> }, 
>> 'portal': { 
>> 'ENGINE': 'django.db.backends.mysql', 
>> 'NAME' : 'XXX', 
>> 'HOST' : 'localhost', 
>> 'USER' : '', 
>> 'PASSWORD' : 'X', 
>> 'PORT' : '3306', 
>> #'ATOMIC_REQUESTS':True, 
>> } 
>> } 
>>
>> #- 
>>
>> Traceback (most recent call last): 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/utils.py",
>>  
>>
>> line 85, in _execute 
>> return self.cursor.execute(sql, params) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/mysql/base.py",
>>  
>>
>> line 71, in execute 
>> return self.cursor.execute(query, args) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>  
>>
>> line 250, in execute 
>> self.errorhandler(self, exc, value) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>>  
>>
>> line 50, in defaulterrorhandler 
>> raise errorvalue 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>  
>>
>> line 247, in execute 
>> res = self._query(query) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>  
>>
>> line 412, in _query 
>> rowcount = self._do_query(q) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>>  
>>
>> line 375, in _do_query 
>> db.query(q) 
>>
>>   File 
>> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>>  
>>
>> line 276, in query 
>> _mysql.connection.query(self, query) 
>>
>> _mysql_exceptions.OperationalError: (1305, 'FUNCTION 
>> scanner.REGEXP_LIKE does not exist') 
>>
>>
>> The above exception was the direct cause of the following exception: 
>>
>>
>> -- 
>> == 
>> Hiroyuki Yamashita 山下 裕之 
>> == 
>>
>

-- 
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/c0082594-25e3-4a33-926d-d70ddbedea5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: find difference of dates between today and filter list[dates]

2018-07-26 Thread Derek
Here's a created list of dates (before and after today) and a way to 
calculate the offset days relative to today ("now") and alert at a set 
interval:

from __future__ import print_function
import datetime

now = datetime.datetime.now()
dates = []
for d in range(7, 0, -1):
dates.append(datetime.datetime.now() - datetime.timedelta(days=d))
for d in range(1, 8):
dates.append(datetime.datetime.now() + datetime.timedelta(days=d))
for _date in dates:
diff = _date - now
print(_date.strftime('%Y%m%d'), diff.days)
if diff.days == 3:
print('Alert @ 3 days!')


On Wednesday, 25 July 2018 21:12:54 UTC+2, deepak madan wrote:
>
> HOW to find the difference between a list of dates and today and find the 
> difference matches some days difference. 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/146e56b9-31b6-4fa4-9c08-4947dd75a087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to install django if user is using spyder

2018-07-26 Thread Derek
First - please don't hijack another topic; rather start your own.

Second - Django recommends you use pip inside a virtualenv (for 
development); see:
https://docs.djangoproject.com/en/2.0/topics/install/#installing-an-official-release-with-pip


On Tuesday, 24 July 2018 15:33:16 UTC+2, Akhil Reddy wrote:
>
> Hello guys
> I'm using spyder it contain python 3.6 so how I can I install django
> Please help me
>
> On Tue 24 Jul, 2018 6:46 pm John Son,  > wrote:
>
>> *models.py*
>> class Post(models.Model):
>> title = models.CharField(max_length=200)
>> body = models.TextField()
>> user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, 
>> null=True)
>> date = models.DateField(default=datetime.now, blank=True)
>> text_author = models.CharField(max_length=200, null=True, blank=True)
>>
>> *forms.py*
>> class PostForm(forms.ModelForm):
>> class Meta:
>> model = Post
>> fields = ("title", "body", "user", "text_author")
>> *views.py*
>> def create_Post(request):
>> form = PostForm(request.POST or None)
>> if form.is_valid():
>> instance = form.save(commit=False)
>> instance.save()
>> return HttpResponseRedirect (instance.get_absolute_url())
>> context = {
>> "form": form,
>> }
>> return render(request, 'blog/create.html', context)
>>
>> *As shown in attached image, the user has to select themselves from list 
>> of users before they can submit their post.(which doesn't make sense). I 
>> want the form to know which user is writing the form(assuming they are 
>> logged in) so the user doesn't have to identify themselves before they 
>> submit their post. I'm guessing I need to edit my models.py but I have no 
>> idea. Please Help.*
>>
>> *Thank you.*
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@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/75d197ab-503c-4aed-83ce-210831fb1502%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/a2a1be1a-41d4-4621-9414-5424b080f7ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: learn dijango

2018-07-26 Thread roshan ro
Hey,
Yes you can , familiarize yourself with some oops concepts and learn python
, you can does by doing some of the free materials on online , it would be
better if you learn from the documentation itself.

On Thu, Jul 26, 2018 at 7:44 PM arul  wrote:

> *I just entered the programming world and i know little bit
> javascript,HTML can learn even I don't  know any oop/scripting language can
> I learn django for now is there any possibility*
>
> --
> 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/6a647470-b7e2-49a9-b323-6d820f4843d2%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/CAMH9S2_TaUvxEA%2B-Ty6Y3c%3DgCnpRwvfTEbH9x-5F1-6yAs6Afw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: learn dijango

2018-07-26 Thread victor reyes
Some python knomedge is  a must if you plan on using Django. I also would
recomend  some basic mysql or postgres understanding

On Thu, Jul 26, 2018, 7:14 AM arul  wrote:

> *I just entered the programming world and i know little bit
> javascript,HTML can learn even I don't  know any oop/scripting language can
> I learn django for now is there any possibility*
>
> --
> 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/6a647470-b7e2-49a9-b323-6d820f4843d2%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/CAAfqA0gy9TsMAQ5%2BdFvfTfmf55XOLCgsimGocpS3Xds-rj-jhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: learn dijango

2018-07-26 Thread Kasper Laudrup

Hi Arul

On 2018-07-26 07:55, arul wrote:
*I just entered the programming world and i know little bit 
javascript,HTML can learn even I don't  know any oop/scripting language 
can I learn django for now is there any possibility*




Django is a framework, not a programming language.

Django is written in Python and thankfully Python is IMO a very nice 
language for a beginner to learn, while still being very useful for 
"real stuff" eg. building websites in a framework like Django.


So my suggestion would be, that you start by learning at least the 
basics of Python. There a tons of tutorials and books on that out there. 
I cannot really recommend anything, but maybe someone else can?


In my opinion, if you start by trying to learn both a programming 
language (Python) and a framework (Django) at the same time, you are 
only making things harder for yourself. Just my 2 cents.


Kind regards,

Kasper Laudrup

--
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/18412ab5-036f-63de-634e-d01b7198189b%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


learn dijango

2018-07-26 Thread arul
*I just entered the programming world and i know little bit 
javascript,HTML can learn even I don't  know any oop/scripting language can 
I learn django for now is there any possibility*

-- 
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/6a647470-b7e2-49a9-b323-6d820f4843d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
If I use as yours then there is no any trace in logs.

On Thursday, July 26, 2018 at 7:12:31 PM UTC+5:30, prateek gupta wrote:
>
> I am using like below-
>
> logging({
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'default': {
> # exact format is not important, this is the minimum information
> 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
> },
> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
> },
> 'handlers': {
> # console logs to stderr
> 'console': {
> 'class': 'logging.StreamHandler',
> 'formatter': 'default',
> },
> # Add Handler for Sentry for `warning` and above
> 'sentry': {
> 'level': 'WARNING',
> 'class': 
> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
> },
> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
> },
> 'loggers': {
> # default for all undefined Python modules
> '': {
> 'level': 'WARNING',
> 'handlers': ['console', 'sentry'],
> },
> # Our application code
> 'app': {
> 'level': LOGLEVEL,
> 'handlers': ['console', 'sentry'],
> # Avoid double logging because of root logger
> 'propagate': False,
> },
> # Prevent noisy modules from logging to Sentry
> 'noisy_module': {
> 'level': 'ERROR',
> 'handlers': ['console'],
> 'propagate': False,
> },
> # Default runserver request logging
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> },
> })
>
>
>
>
> On Thursday, July 26, 2018 at 7:11:22 PM UTC+5:30, prateek gupta wrote:
>>
>> then it says -
>> File "", line 219, in 
>> _call_with_frames_removed
>>   File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>> TypeError: 'module' object is not callable
>>
>>
>>
>> On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>>>
>>> no, I mean like this:
>>>
>>> LOGGING = {
>>> 'version': 1,
>>> 'disable_existing_loggers': False,
>>> 'formatters': {
>>> 'default': {
>>> # exact format is not important, this is the minimum 
>>> information
>>> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
>>> %(message)s',
>>> },
>>> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
>>> },
>>> 'handlers': {
>>> # console logs to stderr
>>> 'console': {
>>> 'class': 'logging.StreamHandler',
>>> 'formatter': 'default',
>>> },
>>> # Add Handler for Sentry for `warning` and above
>>> 'sentry': {
>>> 'level': 'WARNING',
>>> 'class': 
>>> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
>>> },
>>> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
>>> },
>>> 'loggers': {
>>> # default for all undefined Python modules
>>> '': {
>>> 'level': 'WARNING',
>>> 'handlers': ['console', 'sentry'],
>>> },
>>> # Our application code
>>> 'app': {
>>> 'level': LOGLEVEL,
>>> 'handlers': ['console', 'sentry'],
>>> # Avoid double logging because of root logger
>>> 'propagate': False,
>>> },
>>> # Prevent noisy modules from logging to Sentry
>>> 'noisy_module': {
>>> 'level': 'ERROR',
>>> 'handlers': ['console'],
>>> 'propagate': False,
>>> },
>>> # Default runserver request logging
>>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>>> },
>>> }
>>>
>>

-- 
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/014e5f82-87cd-4c85-9e21-1248ed83ce28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I am using like below-

logging({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 7:11:22 PM UTC+5:30, prateek gupta wrote:
>
> then it says -
> File "", line 219, in 
> _call_with_frames_removed
>   File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> TypeError: 'module' object is not callable
>
>
>
> On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>>
>> no, I mean like this:
>>
>> LOGGING = {
>> 'version': 1,
>> 'disable_existing_loggers': False,
>> 'formatters': {
>> 'default': {
>> # exact format is not important, this is the minimum 
>> information
>> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
>> %(message)s',
>> },
>> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
>> },
>> 'handlers': {
>> # console logs to stderr
>> 'console': {
>> 'class': 'logging.StreamHandler',
>> 'formatter': 'default',
>> },
>> # Add Handler for Sentry for `warning` and above
>> 'sentry': {
>> 'level': 'WARNING',
>> 'class': 
>> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
>> },
>> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
>> },
>> 'loggers': {
>> # default for all undefined Python modules
>> '': {
>> 'level': 'WARNING',
>> 'handlers': ['console', 'sentry'],
>> },
>> # Our application code
>> 'app': {
>> 'level': LOGLEVEL,
>> 'handlers': ['console', 'sentry'],
>> # Avoid double logging because of root logger
>> 'propagate': False,
>> },
>> # Prevent noisy modules from logging to Sentry
>> 'noisy_module': {
>> 'level': 'ERROR',
>> 'handlers': ['console'],
>> 'propagate': False,
>> },
>> # Default runserver request logging
>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>> },
>> }
>>
>

-- 
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/132215aa-cd10-471a-914c-4b0d0a4c8670%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
then it says -
File "", line 219, in _call_with_frames_removed
  File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
TypeError: 'module' object is not callable



On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>
> no, I mean like this:
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'default': {
> # exact format is not important, this is the minimum 
> information
> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
> %(message)s',
> },
> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
> },
> 'handlers': {
> # console logs to stderr
> 'console': {
> 'class': 'logging.StreamHandler',
> 'formatter': 'default',
> },
> # Add Handler for Sentry for `warning` and above
> 'sentry': {
> 'level': 'WARNING',
> 'class': 
> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
> },
> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
> },
> 'loggers': {
> # default for all undefined Python modules
> '': {
> 'level': 'WARNING',
> 'handlers': ['console', 'sentry'],
> },
> # Our application code
> 'app': {
> 'level': LOGLEVEL,
> 'handlers': ['console', 'sentry'],
> # Avoid double logging because of root logger
> 'propagate': False,
> },
> # Prevent noisy modules from logging to Sentry
> 'noisy_module': {
> 'level': 'ERROR',
> 'handlers': ['console'],
> 'propagate': False,
> },
> # Default runserver request logging
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> },
> }
>

-- 
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/8c7a601f-903e-43b9-b69b-207702983fb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
no, I mean like this:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 
'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
}

-- 
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/55aff4e2-c3be-43cc-be17-1780b71882f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I have changes like below but does not have any affect-

import logging
# Disable Django's logging setup
LOGGING_CONFIG = None

LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 6:22:45 PM UTC+5:30, Jason wrote:
>
> You need to add the logging config to `LOGGING` in the settings for django 
> to pick it up.   logging.config.dictConfig   doesn't do 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/3eec4623-e36e-4a09-a070-ad93659bf054%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
You need to add the logging config to `LOGGING` in the settings for django 
to pick it up.   logging.config.dictConfig   doesn't do 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/0286e322-f066-4dec-9ff5-3983a87308e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I tried with below one to include warning also but no any warning or error 
in logs-

LOGGING_CONFIG = None

LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 6:06:16 PM UTC+5:30, Jason wrote:
>
> OK, that's helpful.  Your loggers are set to handle error and above, 
> right?  So Django's blocked from doing any logging below that, even with 
> DEBUG = True
>
> On Thursday, July 26, 2018 at 7:46:19 AM UTC-4, prateek gupta wrote:
>>
>> I forgot to mentions, I am using logger also as below-
>>
>> # send server errors to admin
>> ADMINS = (('admin', 'ad...@example.com'),)
>> MANAGERS = ADMINS
>>
>> # Logging configuration for production
>> LOGGING = {
>> 'version': 1,
>> 'disable_existing_loggers': False,
>> 'formatters': {
>> 'verbose': {
>> 'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
>> %(funcName)s() : %(message)s'
>> },
>> 'simple': {
>> 'format': '%(asctime)s [%(levelname)s] : %(message)s'
>> },
>> },
>> 'handlers': {
>> 'file': {
>> 'level': 'ERROR',
>> 'class': 'logging.FileHandler',
>> 'filename': 'error.log',
>> 'formatter': 'verbose'
>> },
>> 'mail_admins': {
>> 'level': 'ERROR',
>> 'class': 'django.utils.log.AdminEmailHandler',
>> 'formatter': 'simple'
>> },
>> },
>> 'loggers': {
>> 'django': {
>> 'handlers': ['file'],
>> 'level': 'ERROR',
>> 'propagate': True,
>> },
>> 'django.request': {
>> 'handlers': ['mail_admins'],
>> 'level': 'ERROR',
>> 'propagate': True,
>> },
>> },
>> }
>>
>>
>>
>>
>> On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
>>>
>>> ok, so you don't even have any logging configuration at all, no wonder 
>>> you don't see anything.
>>>
>>> I suggest you look in the docs for this:  
>>> https://docs.djangoproject.com/en/2.0/topics/logging/
>>>
>>> decent example  
>>> https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7
>>>
>>> more reading  https://lincolnloop.com/blog/django-logging-right-way/
>>>
>>

-- 
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/ff6f8a29-0bcb-4cbe-a42f-15b6d424d366%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
OK, that's helpful.  Your loggers are set to handle error and above, 
right?  So Django's blocked from doing any logging below that, even with 
DEBUG = True

On Thursday, July 26, 2018 at 7:46:19 AM UTC-4, prateek gupta wrote:
>
> I forgot to mentions, I am using logger also as below-
>
> # send server errors to admin
> ADMINS = (('admin', 'ad...@example.com'),)
> MANAGERS = ADMINS
>
> # Logging configuration for production
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'verbose': {
> 'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
> %(funcName)s() : %(message)s'
> },
> 'simple': {
> 'format': '%(asctime)s [%(levelname)s] : %(message)s'
> },
> },
> 'handlers': {
> 'file': {
> 'level': 'ERROR',
> 'class': 'logging.FileHandler',
> 'filename': 'error.log',
> 'formatter': 'verbose'
> },
> 'mail_admins': {
> 'level': 'ERROR',
> 'class': 'django.utils.log.AdminEmailHandler',
> 'formatter': 'simple'
> },
> },
> 'loggers': {
> 'django': {
> 'handlers': ['file'],
> 'level': 'ERROR',
> 'propagate': True,
> },
> 'django.request': {
> 'handlers': ['mail_admins'],
> 'level': 'ERROR',
> 'propagate': True,
> },
> },
> }
>
>
>
>
> On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
>>
>> ok, so you don't even have any logging configuration at all, no wonder 
>> you don't see anything.
>>
>> I suggest you look in the docs for this:  
>> https://docs.djangoproject.com/en/2.0/topics/logging/
>>
>> decent example  
>> https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7
>>
>> more reading  https://lincolnloop.com/blog/django-logging-right-way/
>>
>

-- 
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/76977bb7-8ca1-4460-8321-6aad3e002dc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I forgot to mentions, I am using logger also as below-

# send server errors to admin
ADMINS = (('admin', 'ad...@example.com'),)
MANAGERS = ADMINS

# Logging configuration for production
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
%(funcName)s() : %(message)s'
},
'simple': {
'format': '%(asctime)s [%(levelname)s] : %(message)s'
},
},
'handlers': {
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': 'error.log',
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'formatter': 'simple'
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
},
}




On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
>
> ok, so you don't even have any logging configuration at all, no wonder you 
> don't see anything.
>
> I suggest you look in the docs for this:  
> https://docs.djangoproject.com/en/2.0/topics/logging/
>
> decent example  
> https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7
>
> more reading  https://lincolnloop.com/blog/django-logging-right-way/
>

-- 
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/9f5d530e-4dcc-4082-a8a8-321ff8c03a7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
ok, so you don't even have any logging configuration at all, no wonder you 
don't see anything.

I suggest you look in the docs for this:  
https://docs.djangoproject.com/en/2.0/topics/logging/

decent example  
https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7

more reading  https://lincolnloop.com/blog/django-logging-right-way/

-- 
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/af79409e-13f6-4b1a-b9d4-3ca9257aa290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
PFB my settings-
# Reading data from the environment file
ENV_FILE_PATH = os.path.join(BASE_DIR, 'config.json')
try:
with open(ENV_FILE_PATH) as env_file:
ENV_TOKENS = json.load(env_file)
except IOError:
logger = logging.getLogger(__name__)
logger.warning('Couldn\'t find the env file! You running on '
   'absolute dummy configurations.')
ENV_TOKENS = {}

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True



On Thursday, July 26, 2018 at 4:11:27 PM UTC+5:30, Jason wrote:
>
> sounds like you have a misconfiguration with your logging.  post your 
> LOGGING dict in your settings
>
> On Thursday, July 26, 2018 at 1:20:07 AM UTC-4, prateek gupta wrote:
>>
>> Hi Experts,
>>
>> I am facing a strange issue in my Django2.0.6+Mysql application.
>>
>> In my settings ,py I have set Debug=True, but in logs I am not seeing any 
>> info/warning/error.
>>
>> Currently I am merging two products into one to remove duplicate products 
>> from Django admin panel but when I click on Preview button page is just 
>> refreshed; no any error in logs.
>>
>> So I need to investigate the cause but unable to find since not getting 
>> any logs.
>>
>> Can anyone please tell me how can enable logs here?
>>
>> 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/80a3b816-2539-4f36-ae1e-7789f17ec0d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
sounds like you have a misconfiguration with your logging.  post your 
LOGGING dict in your settings

On Thursday, July 26, 2018 at 1:20:07 AM UTC-4, prateek gupta wrote:
>
> Hi Experts,
>
> I am facing a strange issue in my Django2.0.6+Mysql application.
>
> In my settings ,py I have set Debug=True, but in logs I am not seeing any 
> info/warning/error.
>
> Currently I am merging two products into one to remove duplicate products 
> from Django admin panel but when I click on Preview button page is just 
> refreshed; no any error in logs.
>
> So I need to investigate the cause but unable to find since not getting 
> any logs.
>
> Can anyone please tell me how can enable logs here?
>
> 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/b0026a4a-aa32-483a-85eb-6583392567f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Jason
what's the django orm code that generates that query?

On Thursday, July 26, 2018 at 12:12:06 AM UTC-4, Hiroyuki Yamashita wrote:
>
> My name is Hiroyuki Yamashia. 
>
> Create SQL query function is wrong by Django2.0.7. 
>
> I using MariaDB and using "__regex". 
>
> Django2.0.7 is generate this SQL query. 
>
> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 225 AND 
> `scanner_tmpresponse_07`.`deleted` = False AND 
> `scanner_tmpresponse_07`.`disabled` = False AND 
> REGEXP_LIKE(`scanner_tmpresponse_07`.`response_body`, 
> .*192\.168\.\d+\.\d+.*, 'c')) ORDER BY `scanner_tmpresponse_07`.`id` 
> ASC 
>
> I think "REGEXP_LIKE" is Oracle function for Regular expression. 
>
> Django2.0.6 is generate this SQL query. 
> This version is no problem. 
>
> SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07` 
> WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 224 AND 
> `scanner_tmpresponse_07`.`deleted` = False AND 
> `scanner_tmpresponse_07`.`disabled` = False AND 
> `scanner_tmpresponse_07`.`response_body` REGEXP BINARY 
> .*192\.168\.\d+\.\d+.*) ORDER BY `scanner_tmpresponse_07`.`id` ASC 
>
>
> #- 
> settings.py 
>
> DATABASES = { 
> 'default': { 
> 'ENGINE': 'django.db.backends.mysql', 
> 'NAME' : 'XXX', 
> 'HOST' : 'localhost', 
> 'USER' : '', 
> 'PASSWORD' : 'X', 
> 'PORT' : '3306', 
> #'ATOMIC_REQUESTS':True, 
>
> }, 
> 'scanner': { 
> 'ENGINE': 'django.db.backends.mysql', 
> 'NAME' : 'XXX', 
> 'HOST' : 'localhost', 
> 'USER' : '', 
> 'PASSWORD' : 'X', 
> 'PORT' : '3306', 
> #'ATOMIC_REQUESTS':True, 
>
> }, 
> 'portal': { 
> 'ENGINE': 'django.db.backends.mysql', 
> 'NAME' : 'XXX', 
> 'HOST' : 'localhost', 
> 'USER' : '', 
> 'PASSWORD' : 'X', 
> 'PORT' : '3306', 
> #'ATOMIC_REQUESTS':True, 
> } 
> } 
>
> #- 
>
> Traceback (most recent call last): 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/utils.py",
>  
>
> line 85, in _execute 
> return self.cursor.execute(sql, params) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/mysql/base.py",
>  
>
> line 71, in execute 
> return self.cursor.execute(query, args) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>  
>
> line 250, in execute 
> self.errorhandler(self, exc, value) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>  
>
> line 50, in defaulterrorhandler 
> raise errorvalue 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>  
>
> line 247, in execute 
> res = self._query(query) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>  
>
> line 412, in _query 
> rowcount = self._do_query(q) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
>  
>
> line 375, in _do_query 
> db.query(q) 
>
>   File 
> "/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
>  
>
> line 276, in query 
> _mysql.connection.query(self, query) 
>
> _mysql_exceptions.OperationalError: (1305, 'FUNCTION 
> scanner.REGEXP_LIKE does not exist') 
>
>
> The above exception was the direct cause of the following exception: 
>
>
> -- 
> == 
> Hiroyuki Yamashita 山下 裕之 
> == 
>

-- 
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/f58aa4b4-e870-4264-82e9-467d6da72e3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Oracle Connection Problem

2018-07-26 Thread Kasper Laudrup

Hi Razibul,

On 2018-07-26 02:43, Md. Razibul Hasan Mithu wrote:

In oracle database ,what does NAME and HOST mean? Can you tell me in details?



NAME is the name of the database, HOST is the hostname of the server 
running the database. Details here:


https://docs.djangoproject.com/en/2.0/ref/databases/

Kind regards,

Kasper Laudrup

--
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/9f5d9582-b182-2b50-2cd1-58757237f080%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.