mirror of
https://github.com/andwati/andwati.com.git
synced 2026-11-28 11:28:46 +00:00
publish site
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
---
|
||||
title: "Django Secret Key Tutorial"
|
||||
date: 2022-11-11T15:34:14.160Z
|
||||
# weight: 1
|
||||
# aliases: ["/first"]
|
||||
tags: ["tutorial", "Django", "Python", ".emv"]
|
||||
author: "Ian Andwati"
|
||||
showToc: true
|
||||
TocOpen: false
|
||||
draft: false
|
||||
hidemeta: false
|
||||
comments: false
|
||||
description: "django secret key tutorial"
|
||||
canonicalURL: ""
|
||||
disableHLJS: true # to disable highlightjs
|
||||
disableShare: false
|
||||
disableHLJS: false
|
||||
hideSummary: false
|
||||
searchHidden: true
|
||||
ShowReadingTime: true
|
||||
ShowBreadCrumbs: true
|
||||
ShowPostNavLinks: true
|
||||
ShowWordCount: true
|
||||
ShowRssButtonInSectionTermList: true
|
||||
UseHugoToc: true
|
||||
cover:
|
||||
image: "<image path/url>" # image path/url
|
||||
alt: "<alt text>" # alt text
|
||||
caption: "<text>" # display caption under cover
|
||||
relative: false # when using page bundles set this to true
|
||||
hidden: true # only hide on current single page
|
||||
editPost:
|
||||
URL: "https://github.com/andwati/content"
|
||||
Text: "Suggest Changes" # edit text
|
||||
appendFilePath: true # to append file path to Edit link
|
||||
---
|
||||
|
||||
Managing the Django SECRET_KEY variable.
|
||||
|
||||
<!--more-->
|
||||
|
||||
The Django `SECRET_KEY` 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 `django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty` error
|
||||
|
||||
# Using Environment Variables
|
||||
|
||||
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.
|
||||
|
||||
# Generating A New Secret Key
|
||||
|
||||
This solution is using python's secrets lib on the back
|
||||
|
||||
```python
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
# print new random secret key
|
||||
print(get_random_secret_key())
|
||||
```
|
||||
|
||||
This code can be run in the terminal as a command:
|
||||
|
||||
```python
|
||||
python -c 'from django.core.management.utils import get_random_secret_key; \
|
||||
print(get_random_secret_key())'
|
||||
```
|
||||
|
||||
Alternatively, If you are using python 3.6+ then you can use the `secrets.token_hex(\[nbytes=None])` function:
|
||||
|
||||
```python
|
||||
python3 -c 'import secrets; print(secrets.token_hex(100))'
|
||||
```
|
||||
@@ -8,7 +8,7 @@ TocOpen: false
|
||||
draft: false
|
||||
hidemeta: false
|
||||
comments: false
|
||||
description: "Integrating netlify cms."
|
||||
description: "Hello world"
|
||||
canonicalURL: ""
|
||||
disableHLJS: true # to disable highlightjs
|
||||
disableShare: false
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
---
|
||||
title: "Semantic Versioning(SemVer) and Conventional Commits"
|
||||
date: 2023-01-24T15:34:14.160Z
|
||||
# weight: 1
|
||||
# aliases: ["/first"]
|
||||
tags: ["git", "semver","workflow", "conventional commits"]
|
||||
author: "Ian Andwati"
|
||||
showToc: true
|
||||
TocOpen: false
|
||||
draft: false
|
||||
hidemeta: false
|
||||
comments: false
|
||||
description: "semantic versioning"
|
||||
canonicalURL: ""
|
||||
disableHLJS: true # to disable highlightjs
|
||||
disableShare: false
|
||||
disableHLJS: false
|
||||
hideSummary: false
|
||||
searchHidden: true
|
||||
ShowReadingTime: true
|
||||
ShowBreadCrumbs: true
|
||||
ShowPostNavLinks: true
|
||||
ShowWordCount: true
|
||||
ShowRssButtonInSectionTermList: true
|
||||
UseHugoToc: true
|
||||
cover:
|
||||
image: "<image path/url>" # image path/url
|
||||
alt: "<alt text>" # alt text
|
||||
caption: "<text>" # display caption under cover
|
||||
relative: false # when using page bundles set this to true
|
||||
hidden: true # only hide on current single page
|
||||
editPost:
|
||||
URL: "https://github.com/andwati/content"
|
||||
Text: "Suggest Changes" # edit text
|
||||
appendFilePath: true # to append file path to Edit link
|
||||
---
|
||||
|
||||
Adopting best practices in your git and build workflows.
|
||||
|
||||
<!--more-->
|
||||
|
||||
# What is Semver?
|
||||
|
||||
Semantic versioning or just SemVer is a dependency naming guidline that aims to bring some sanity into naming libraries and packages in software development. It is a standard versioning system created by **Tom Preston Werner** (co-founder of Github) that’s used to communicate what changes are in a release.
|
||||
|
||||
An efficient and smooth versioning becomes crucial for efficient software delivery expecially for projects that expose a public API. This saves the developers the chaos that is **dependency hell**.Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages.
|
||||
|
||||
The dependency issue arises when several packages have dependencies on the same shared packages or libraries, but they depend on different and incompatible versions of the shared packages. If the shared package or library can only be installed in a single version, the user may need to address the problem by obtaining newer or older versions of the dependent packages. This, in turn, may break other dependencies and push the problem to another set of packages.
|
||||
|
||||
## Semantic Versioning Specifications
|
||||
|
||||
### Summary
|
||||
|
||||
Semantic versioning is based on three numbers that indicate the versions of the software and the compatibilities.They are `X.Y.Z` correspondind to `Major.Minor.Patch`
|
||||
|
||||
- **Major Version (X):**Introduces major changes to the code and breaking changes toward backward compatibility
|
||||
- **Minor Version (Y):** These code changes don’t introduce breaking changes. This could be adding a new feature that doesn't break changes but are not exactly bug fixes.
|
||||
- **Patches (Z):** Mainly correspond to bug fixes
|
||||
|
||||
### Examples in common packages
|
||||
|
||||
#### React(v18.2.0)
|
||||
|
||||

|
||||
|
||||
- **Major -> 18**
|
||||
- **Minor -> 2**
|
||||
- **Patch -> 0**
|
||||
|
||||
---
|
||||
|
||||
#### Pipx(v1.1.0)
|
||||
|
||||

|
||||
|
||||
- **Major -> 1**
|
||||
- **Minor -> 1**
|
||||
- **Patch -> 0**
|
||||
|
||||
---
|
||||
|
||||
## Start at v0.1.0 or v1.0.0?
|
||||
|
||||
Convention recommends that in the initial development phase the starting version should be 0.1.0 which makes sense since it’s not in production yet.
|
||||
|
||||
The version should only be bumped to 1.0.0 only if it is being used in production and stable.
|
||||
|
||||
If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
|
||||
|
||||
# Conventional Commits
|
||||
|
||||
Conventional Commits is a convention on top of commit messages that are used to automate version changes. It provides an easy set of rules for creating commit messages and works well with SemVer by describing features, fixes and breaking changes that correspond to SemVer standards.
|
||||
|
||||
## Summary
|
||||
|
||||
The commit message should be structured as follows:
|
||||
|
||||
```
|
||||
<type>[optional scope]: <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
The commit contains the following structural elements, to communicate intent to the consumers of your library:
|
||||
|
||||
1. fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).
|
||||
2. feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).
|
||||
3. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
|
||||
4. types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others.
|
||||
5. footers other than BREAKING CHANGE: <description> may be provided and follow a convention similar to git trailer format.
|
||||
|
||||
# Resources
|
||||
|
||||
https://semver.org/
|
||||
https://www.conventionalcommits.org/en/v1.0.0/
|
||||
Reference in New Issue
Block a user