Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 14 16:11
    @MadLittleMods banned @Rehmanjeff
matrixbot
@matrixbot

vladox > Is anyone able to point me at some resources for improving logging/debugging on a 500 server error? The issue seems particularly difficult to search for... I'm seeing something along the lines of this: [13/Feb/2020 11:48:28] "POST /shop_alt/product/membership/ HTTP/1.1" 500 49 and I'd like to see a stacktrace (or even debug) to know why. DEBUG=True, but that one line is all I get. I have tried various logging configs I've found but none have given any more information.

django==1.11.20
mezzanine==4.3.1
cartridge==0.13.0

are the main packages...

Install Sentry if it's remote

vladox Use Pycharm if local
Kevin Dahl
@blitzd
thanks - already using pycharm local, but these 500 errors seem to get caught somewhere along the way in the stack. Other 500 errors DO produce a stack trace to the local console (or our configured logging in our PROD setup), but these ones do not.
Hanny Goodwin
@hannylicious

I would recommend checking your logging settings then. 5xx errors should be getting caught by the django.request logger or the django.server logger I would think (depending where it's happening obviously). Since it's a POST request to a specific URL making the 500 error appear - django.request logging handler will record and give appropriate data on it assuming the logger is configured correctly.

Seems like a logging settings issue to me.

Kevin Dahl
@blitzd

Here's my LOGGING (based on very basic example from docs):

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'file': {
            'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
        },
    },
    'handlers': {
        'file': {
            'formatter': 'file',
            'class': 'logging.FileHandler',
            'filename': f'/tmp/debug.log',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'level': 'DEBUG',
        },
        'django.db': {
            'handlers': ['file'],
            'level': 'ERROR',
        },
    },
}

Still only get this with that though:

2020-02-13 15:19:36,929 django.server ERROR "POST /shop_alt/product/membership/ HTTP/1.1" 500 49

Hanny Goodwin
@hannylicious

Under 'loggers', add another with django.request (copy/paste the one for django.db and replace db with request).

Set the level to INFO and try it again.

Kevin Dahl
@blitzd
done - but same thing...
I think I can carry on fixing this particular problem with some manual breakpoints, but it's very concerning to me we're losing errors somewhere along the way. I suspect it has something to do with Mezzanine
Hanny Goodwin
@hannylicious
Ah! Yeah, you could be correct. I apologize, I was unfamiliar with mezzanine (never seen it or used it); could be something going on there. I would check their docs to see if they have some logging utilities you could utilize. I would imagine they have to have something... otherwise you'd just be guessing at things...
I didn't see mezzanine until I went back and looked at your previous post - sorry about that. Still, I'm surprised the core django logging isn't catching it... mezzanine must abstract some of that away.
Buğra
@BgR8
hey i have a question about diagram
i don't understand this question how can i do that
Hanny Goodwin
@hannylicious
The question just wants you to create a diagram (I'm assuming similar to the one they've given you).
@hannylicious
Buğra
@BgR8
is it true anyone else know
vadisinasaisudha
@SaiSudhaV
Hello I am new to open source can anyone help me how to contribute
Harpreet Singh
@Harpreet1999
hey there how's everyone. I'm here to say hi. to the community. Currently working on the polls tutorial, i've gone through the basics and hopefullly i'll complete it in few days. i'm looking forward working with you guys.
Bo
@BoPeng
I am trying to return the "latest version" if there are multiple versions of the same book from a list. It is like Book.objects.values('title').annotate(Max('version'))but I would like to get the original Book objects, not the versions. How can I do that?
Nam Le
@leqnam
@BoPeng have you tried this? https://stackoverflow.com/a/30777133
Bo
@BoPeng
I cannot see how it is related to my question at a first glance. My books have different versions but they are separated and have different permissions, in the sense that a visitor can see the latest published version and an editor can see the latest under-review version, so there is no universal latest for all visitors. Right now I am doing something like Book.objects.filter(... according to visitor) then get the latest allowed versions in Python, and I am wondering if there is a SQL / DRM solution here.
I could compute a bunch of flags such as latest_under_review, latest_published but keeping track of these flags with the addition and removal of books can be a hassle.
On the SQL side https://stackoverflow.com/questions/6841605/get-top-1-row-of-each-group suggests the use of cross apply, which does not seem to be supported by django DRM.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@anjumuaf123_twitter
hi any body Please, how can i update 3.6 to 3.8 python version on window 10
?
Hanny Goodwin
@hannylicious
Download Python3.8, Install it on Windows10 same as you did 3.6 and use both (should you want) or just uninstall 3.6 if 3.8 works for you. You can have multiple versions of Python installed (in my experience it has worked without issue).
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious Thanks sir, but I want to use only 3.8 , just to update 3.6 to 3.8 , I have already installed 3.6
Hanny Goodwin
@hannylicious

I think you can just download 3.8 and install it, and then uninstall 3.6.

I don't think there is an 'upgrade in place' type option.

Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious Sir, thanks , but in the you tube I saw one video , they have option but not for me
@hannylicious sir, in this video it shows .....https://www.youtube.com/watch?v=UXSxBx8eG28
Hanny Goodwin
@hannylicious
In that video - he goes and downloads the latest version of python from the website and runs the installer. So my original advice is correct: go and download Python3.8 and run the installer - then if you want to delete Python3.6, uninstall it.
Dr. Muhammad Anjum
@anjumuaf123_twitter
image.png
@hannylicious sir, please look he has option to upgrade
@hannylicious but me donot have this option why?
Hanny Goodwin
@hannylicious
Because you're installing a different version. That option would probably show up if you were upgrading from 3.6.x to 3.6.x. My understanding is that a 3.8 installation is a completely different, unique install which is separate from a 3.6 installation - so there is not an upgrade option because there is no 3.8 already installed.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious right sir
@hannylicious let me try
image.png
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious sir, you are right , I have 3.6.7 , when i did dowload 3.6.8 , then there was an option to upgrade
Hanny Goodwin
@hannylicious
Excellent, glad we've got it sorted. :) Now you can keep 3.6 installed if you wish and use 3.8, too!
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious sir, I have already Pycharm installed , but from where I can uninstall 3.6.7 to get new latest version 3.8
Hanny Goodwin
@hannylicious
For uninstalling a program on Windows, google will have the answer pretty easily (control panel -> uninstall -> Python3.6)
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious right sir thanks
@hannylicious let me try
Dr. Muhammad Anjum
@anjumuaf123_twitter
image.png
@hannylicious sir, if you see at the bottom at right side there is still 3.6 , but I did installed 3.8, why not it appears here ?
Hanny Goodwin
@hannylicious
I don't use Pycharm, but you can setup Pycharm to use a different version of Python probably pretty easily I imagine. You have to tell Pycharm which version of python to use in preferences/settings I imagine.
Dr. Muhammad Anjum
@anjumuaf123_twitter
@hannylicious let me try sir