<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mockinspectre</title>
    <description>The latest articles on DEV Community by mockinspectre (@mockingspectre).</description>
    <link>https://dev.to/mockingspectre</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F511405%2F818955be-e43c-442f-8549-dc862da0c8c8.jpeg</url>
      <title>DEV Community: mockinspectre</title>
      <link>https://dev.to/mockingspectre</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mockingspectre"/>
    <language>en</language>
    <item>
      <title>Export default and module.exports in Javascript</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Wed, 17 Jan 2024 00:00:00 +0000</pubDate>
      <link>https://dev.to/mockingspectre/export-default-and-moduleexports-in-javascript-47j1</link>
      <guid>https://dev.to/mockingspectre/export-default-and-moduleexports-in-javascript-47j1</guid>
      <description>&lt;p&gt;Modules are the building blocks of modern JavaScript applications, allowing for the encapsulation of code into reusable components. Two primary systems govern the exportation of these modules: export default in ES6 and module.exports in CommonJS.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Setting up Obsidian sync in Windows</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Sun, 01 Oct 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/mockingspectre/setting-up-obsidian-sync-in-windows-57cc</link>
      <guid>https://dev.to/mockingspectre/setting-up-obsidian-sync-in-windows-57cc</guid>
      <description>&lt;p&gt;Syncing Obsidian in Windows with Windows Task Scheduler and git …&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Django Secret Key Tutorial</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Fri, 29 Sep 2023 10:46:32 +0000</pubDate>
      <link>https://dev.to/mockingspectre/django-secret-key-tutorial-19ge</link>
      <guid>https://dev.to/mockingspectre/django-secret-key-tutorial-19ge</guid>
      <description>&lt;h1&gt;
  
  
  Managing the Django SECRET_KEY variable
&lt;/h1&gt;

&lt;p&gt;The Django &lt;code&gt;SECRET_KEY&lt;/code&gt; variable is very crucial to your Django application. The secret key must be a large random value and it must be kept secret. Leaking this value to unauthorized people could lead to a security breach. The SECRET_KEY is used in Django for cryptographic signing. It is used to generate tokens and hashes, they can be recreated using this variable. If it is not configured Django throws a &lt;code&gt;django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty&lt;/code&gt; error&lt;/p&gt;

&lt;h1&gt;
  
  
  Using Environment Variables
&lt;/h1&gt;

&lt;p&gt;The secret key should not be committed to version control. It is best practice to store the value in a .env file which is added to the .gitignore file to un-track its changes. The values can be loaded programmatically into your settings.py file.&lt;/p&gt;

&lt;h1&gt;
  
  
  Generating A New Secret Key
&lt;/h1&gt;

&lt;p&gt;This solution is using Python's secrets lib on the back&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.core.management.utils&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;get_random_secret_key&lt;/span&gt;
&lt;span class="c1"&gt;# print new random secret key
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_random_secret_key&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code can be run in the terminal as a command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;from django.core.management.utils import get_random_secret_key; &lt;/span&gt;&lt;span class="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;            print(get_random_secret_key())&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, If you are using python 3.6+ then you can use the &lt;code&gt;secrets.token_hex(\[nbytes=None])&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;python3&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;import secrets; print(secrets.token_hex(100))&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This article was originally published at: &lt;a href="https://www.andwati.com/posts/generate-django-secret-key/" rel="noopener noreferrer"&gt;https://www.andwati.com/posts/generate-django-secret-key/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>Subresource Integrity</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Sat, 29 Apr 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/mockingspectre/subresource-integrity-12o4</link>
      <guid>https://dev.to/mockingspectre/subresource-integrity-12o4</guid>
      <description>&lt;p&gt;Understanding Subresource Integrity …&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Install PostgreSQL on Arch | Manjaro | Garuda Linux</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Thu, 16 Feb 2023 15:34:14 +0000</pubDate>
      <link>https://dev.to/mockingspectre/install-postgresql-on-arch-manjaro-garuda-linux-2ibf</link>
      <guid>https://dev.to/mockingspectre/install-postgresql-on-arch-manjaro-garuda-linux-2ibf</guid>
      <description>&lt;p&gt;Getting PostgreSQL up and running on Arch Linux-based distros&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Semantic Versioning(SemVer) and Conventional Commits</title>
      <dc:creator>mockinspectre</dc:creator>
      <pubDate>Tue, 24 Jan 2023 15:34:14 +0000</pubDate>
      <link>https://dev.to/mockingspectre/semantic-versioningsemver-and-conventional-commits-4mg9</link>
      <guid>https://dev.to/mockingspectre/semantic-versioningsemver-and-conventional-commits-4mg9</guid>
      <description>&lt;p&gt;Adopting best practices in your git and build workflows. …&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
