<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Disqus - Latest Comments for lincolnloop</title><link>http://disqus.com/by/lincolnloop/</link><description></description><atom:link href="http://disqus.com/lincolnloop/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 12 Mar 2021 15:57:46 -0000</lastBuildDate><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-5301743712</link><description>&lt;p&gt;Logging config applies to all submodules, so if you have a project, `myproject` and setup logging for it, any module underneath it will be logged using that configuration. If your apps are not in the same namespace as your project, you'll need to duplicate the `myproject` logger for each app module name.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 12 Mar 2021 15:57:46 -0000</pubDate></item><item><title>Re: Single-file Python/Django Deployments</title><link>http://lincolnloop.com/blog/single-file-python-django-deployments/#comment-4936123269</link><description>&lt;p&gt;You're probably hitting the "System Dependencies" caveat. My guess is that you need to install the openldap client library on the target system.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 01 Jun 2020 10:07:49 -0000</pubDate></item><item><title>Re: Disabling Error Emails in Django</title><link>http://lincolnloop.com/blog/disabling-error-emails-django/#comment-4655793673</link><description>&lt;p&gt;As long as you are not using `mail_admins` &lt;a href="https://docs.djangoproject.com/en/2.2/topics/email/#mail-admins" rel="nofollow noopener" target="_blank" title="https://docs.djangoproject.com/en/2.2/topics/email/#mail-admins"&gt;https://docs.djangoproject....&lt;/a&gt; that should be a viable option too.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Thu, 17 Oct 2019 10:38:19 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-4604446721</link><description>&lt;p&gt;Give this a try, &lt;a href="https://gist.github.com/ipmb/c957fddf1e06bbf0fead35b917a90790" rel="nofollow noopener" target="_blank" title="https://gist.github.com/ipmb/c957fddf1e06bbf0fead35b917a90790"&gt;https://gist.github.com/ipm...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Wed, 04 Sep 2019 15:37:50 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-4604263111</link><description>&lt;p&gt;Uncaught exceptions should go to stderr by default. See &lt;a href="https://docs.python.org/3/library/sys.html#sys.excepthook" rel="nofollow noopener" target="_blank" title="https://docs.python.org/3/library/sys.html#sys.excepthook"&gt;https://docs.python.org/3/l...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I would double check that they are in-fact uncaught and there isn't something catching them somewhere in the stack. Django's templates have some scenarios where they intentionally catch exceptions (see `silent_variable_failure`).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Wed, 04 Sep 2019 13:10:12 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-4499431258</link><description>&lt;p&gt;Yes&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Wed, 12 Jun 2019 10:20:28 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-4363591481</link><description>&lt;p&gt;Different ways to handle this, but if you really want a "true" package, you should run things like &lt;code&gt;collectstatic&lt;/code&gt; and &lt;code&gt;compilemessages&lt;/code&gt; during the build process. You could then create the package for distribution (deployment).&lt;/p&gt;&lt;p&gt;If you don't have a build pipeline in place or don't want to jump through those hoops, you could just run any necessary commands after installing your package.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 04 Mar 2019 10:41:26 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-4065458944</link><description>&lt;blockquote&gt;Chances are that you're depending on a feature of Python that inserts the current directory onto the Python path. That is a fragile dependency and one that is likely to burn you at some point in deployment. &lt;/blockquote&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Tue, 28 Aug 2018 17:45:27 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-4051778621</link><description>&lt;p&gt;Typically it is combined with a command like &lt;code&gt;tail&lt;/code&gt; to only run on a subset of the log file. If running &lt;code&gt;grep&lt;/code&gt; took fifteen minutes, I'd consider rotating the logs more often.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Tue, 21 Aug 2018 10:09:22 -0000</pubDate></item><item><title>Re: Serving Static Files with uWSGI</title><link>http://lincolnloop.com/blog/serving-static-files-uwsgi/#comment-3922330430</link><description>&lt;p&gt;According to their docs, it is. &lt;a href="http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html" rel="nofollow noopener" target="_blank" title="http://uwsgi-docs.readthedocs.io/en/latest/HTTP.html"&gt;http://uwsgi-docs.readthedo...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Tue, 29 May 2018 13:21:13 -0000</pubDate></item><item><title>Re: Goodbye manage.py</title><link>http://lincolnloop.com/blog/goodbye-managepy/#comment-3900023141</link><description>&lt;p&gt;Hmm, it should be calling the exact same function. The file that gets placed in &lt;code&gt;bin&lt;/code&gt; is just a thin wrapper that calls into your code. Maybe you could put some breakpoints in your code to figure out what is going on. Could be that it is looking for &lt;code&gt;.env&lt;/code&gt; in the wrong directory?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 14 May 2018 09:40:33 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3900019567</link><description>&lt;p&gt;Yep, if your dependencies are declared in &lt;a href="http://setup.py" rel="nofollow noopener" target="_blank" title="setup.py"&gt;setup.py&lt;/a&gt; as well, &lt;code&gt;pip install -e .&lt;/code&gt; is all you need. If you are using a requirements file, you can do it in one shot, &lt;code&gt;pip install -e . -r requirements.txt&lt;/code&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 14 May 2018 09:37:45 -0000</pubDate></item><item><title>Re: Goodbye manage.py</title><link>http://lincolnloop.com/blog/goodbye-managepy/#comment-3864495518</link><description>&lt;p&gt;Hi Shige! 👋&lt;br&gt;Typically we have a couple settings files (local dev and deployment) and are symlinking them to a common place when the environment is setup. We set DJANGO_SETTINGS_MODULE to point to that.&lt;/p&gt;&lt;p&gt;Lately I've been playing around with the idea of flat configuration files instead of multiple settings files. The jury is still out on that though 🙂&lt;a href="https://pypi.org/project/goodconf/" rel="nofollow noopener" target="_blank" title="https://pypi.org/project/goodconf/"&gt;https://pypi.org/project/go...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 20 Apr 2018 14:07:13 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3862827395</link><description>&lt;p&gt;Here you go! &lt;a href="https://lincolnloop.com/blog/goodbye-managepy/" rel="nofollow noopener" target="_blank" title="https://lincolnloop.com/blog/goodbye-managepy/"&gt;https://lincolnloop.com/blo...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Thu, 19 Apr 2018 12:56:24 -0000</pubDate></item><item><title>Re: Django Anti-Patterns: Signals</title><link>http://lincolnloop.com/blog/django-anti-patterns-signals/#comment-3835510565</link><description>&lt;p&gt;From the &lt;a href="https://docs.djangoproject.com/en/2.0/ref/models/instances/#validating-objects" rel="nofollow noopener" target="_blank" title="https://docs.djangoproject.com/en/2.0/ref/models/instances/#validating-objects"&gt;docs&lt;/a&gt;:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;Note, however, that like Model.full_clean(), a model’s clean() method is not invoked when you call your model’s save() method.&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;You need to remember to call the validation code manually if you aren't using a ModelForm.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 02 Apr 2018 10:22:40 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3749169743</link><description>&lt;p&gt;TIL... thanks!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Thu, 08 Feb 2018 14:51:23 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3743627580</link><description>&lt;p&gt;If you search the django-users mailing list, you'll find some evidence that users don't like this pattern. I think since Django doesn't create one by default, people assume they shouldn't use one.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Mon, 05 Feb 2018 10:05:20 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3739073560</link><description>&lt;p&gt;We actually remove the &lt;a href="http://manage.py" rel="nofollow noopener" target="_blank" title="manage.py"&gt;manage.py&lt;/a&gt; file and put the function in &lt;code&gt;myproject/__init__.py&lt;/code&gt; then use the same technique as you are using. It felt a little off-topic for this post, but watch for more details in a future post.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 02 Feb 2018 12:12:28 -0000</pubDate></item><item><title>Re: Using setup.py in Your (Django) Project</title><link>http://lincolnloop.com/blog/using-setuppy-your-django-project/#comment-3738918511</link><description>&lt;p&gt;Yes! Building wheels once and distributing them is a great option. I think that can be done in conjunction with pipenv's superior lock file for internal projects for a best-of-both worlds approach. That being said, I agree, having it all supported in one place would be nice.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 02 Feb 2018 10:36:56 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-3699627684</link><description>&lt;p&gt;Fixed!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Tue, 09 Jan 2018 13:43:55 -0000</pubDate></item><item><title>Re: Disabling Error Emails in Django</title><link>http://lincolnloop.com/blog/disabling-error-emails-django/#comment-3690557318</link><description>&lt;p&gt;Good question! I just tried "Option 2" from the post (setting a "mail_admins" handler to logging.NullHandler), but it gets overwritten when Django applies it's default logging. That leaves you back with options 3 or 4.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Wed, 03 Jan 2018 18:33:31 -0000</pubDate></item><item><title>Re: Django Logging, The Right Way</title><link>http://lincolnloop.com/blog/django-logging-right-way/#comment-3674402867</link><description>&lt;p&gt;Make sure you've followed their &lt;a href="https://docs.sentry.io/clients/python/integrations/django/#setup" rel="nofollow noopener" target="_blank" title="https://docs.sentry.io/clients/python/integrations/django/#setup"&gt;Setup&lt;/a&gt; instructions and that `&lt;a href="http://manage.py" rel="nofollow noopener" target="_blank" title="manage.py"&gt;manage.py&lt;/a&gt; raven test` works.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 22 Dec 2017 09:41:40 -0000</pubDate></item><item><title>Re: Django Patterns: Fat Models and `cached_property`</title><link>http://lincolnloop.com/blog/django-patterns-fat-models-and-cached_property/#comment-3482916974</link><description>&lt;p&gt;Here's an example directly from Django, &lt;a href="https://github.com/django/django/blob/fea9cb46aacc73cabac883a806ccb7fdc1f979dd/tests/prefetch_related/models.py#L218-L236" rel="nofollow noopener" target="_blank" title="https://github.com/django/django/blob/fea9cb46aacc73cabac883a806ccb7fdc1f979dd/tests/prefetch_related/models.py#L218-L236"&gt;https://github.com/django/d...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Wed, 23 Aug 2017 10:22:35 -0000</pubDate></item><item><title>Re: Django Patterns: Fat Models and `cached_property`</title><link>http://lincolnloop.com/blog/django-patterns-fat-models-and-cached_property/#comment-3474495139</link><description>&lt;p&gt;You are correct. In the typical Django project a model instance's lifetime is typically the same as a request's lifetime. I can't think of many instances where you would want to instantiate a model at startup and have it persist for the duration of your WSGI process. In that scenario, it's basically static data and, perhaps not data well suited for a Django model.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Fri, 18 Aug 2017 09:48:03 -0000</pubDate></item><item><title>Re: Django Anti-Patterns: Signals</title><link>http://lincolnloop.com/blog/django-anti-patterns-signals/#comment-3427551586</link><description>&lt;p&gt;This is exactly the same as signals. A failing pre_save signal will prevent committing to the DB. A failing post_save happens after committing to the DB. Without signals it just depends if your code executes before or after the super call.&lt;/p&gt;&lt;p&gt;In general, introducing bugs into your programs is going to cause problems. If you have code that is expected to fail, that's what try/except is for. Using async processes to hide bugs in the code isn't a pattern I'd recommend.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Baumgartner</dc:creator><pubDate>Thu, 20 Jul 2017 18:59:32 -0000</pubDate></item></channel></rss>