<?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: Ryan Glass</title>
    <description>The latest articles on DEV Community by Ryan Glass (@celestialchips).</description>
    <link>https://dev.to/celestialchips</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%2F1235120%2F4bdac2f2-0401-44f8-8afb-673b43941223.jpeg</url>
      <title>DEV Community: Ryan Glass</title>
      <link>https://dev.to/celestialchips</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/celestialchips"/>
    <language>en</language>
    <item>
      <title>RSA Keygen and Management</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Fri, 22 Dec 2023 18:10:17 +0000</pubDate>
      <link>https://dev.to/celestialchips/rsa-keygen-and-management-119h</link>
      <guid>https://dev.to/celestialchips/rsa-keygen-and-management-119h</guid>
      <description>&lt;p&gt;So you're trying to learn how to generate and manage your RSA keys. It's pretty simple. The command below is how you would generally create an RSA key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Skip add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But, if you would like to learn more about the commands continue reading!&lt;/p&gt;

&lt;p&gt;First, up we use ssh-keygen which is the script that is used to generate keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we add some flags each flag does it's own thing.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-t rsa&lt;/code&gt; Specifies the type of key to create. In this case, rsa indicates an RSA key.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-b 4096&lt;/code&gt; Sets the number of bits in the key, in this case, we're setting 4096 bits. A higher bit count increases security but requires more computational power.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-m PEM&lt;/code&gt; Specifies the key format. PEM (Privacy Enhanced Mail) is a base64-encoded DER certificate used for different types of cryptographic keys.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-f jwtRS256.key&lt;/code&gt; This flag sets the filename for the private key. Here, the key is saved as jwtRS256.key.&lt;/p&gt;

&lt;p&gt;That gives us the full command and breakdown of each parts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To recap the command above generates a new RSA private key in PEM format with a length of 4096 bits and saves it as jwtRS256.key. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Executing the ssh-keygen command&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After executing the ssh-keygen command the console will ask you for a passphrase. You can either leave it blank or enter a passphrase. Adding a passphrase is usually used as additional security.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;rsa&lt;/code&gt; specifies the RSA algorithm.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-in jwtRS256.key&lt;/code&gt; Indicates the input file, which is the private key file generated by ssh-keygen.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-pubout&lt;/code&gt; This flag tells OpenSSL to extract the public key from the input file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-outform PEM&lt;/code&gt; Specifies the format for the output file, which is PEM.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-out jwtRS256.key.pub&lt;/code&gt; Sets the filename for the public key. In this case, the public key is saved as jwtRS256.key.pub.&lt;br&gt;
This command uses the private key (jwtRS256.key) to generate a public key and saves it as jwtRS256.key.pub.&lt;/p&gt;

&lt;p&gt;That gives us our full command with explanations of each flag!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally we execute two commands to display our keys&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; is a standard Unix utility that reads files sequentially, writing them to standard output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat jwtRS256.key
cat jwtRS256.key.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands are typically used in scenarios where RSA keys are needed, such as setting up JWT (JSON Web Tokens) authentication where RSA keys are used to sign and verify the tokens. The private key is used to sign the token, and the corresponding public key is used by the receiver to verify its authenticity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v-rE-ooC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6h0oadgikw80vtw0geqy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v-rE-ooC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6h0oadgikw80vtw0geqy.gif" alt="Image description" width="480" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it we've gone over how to create keys and each of the flags used to create these commands.&lt;/p&gt;

</description>
      <category>security</category>
      <category>programming</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Code Quality Checking with Flake8</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Thu, 21 Dec 2023 22:55:27 +0000</pubDate>
      <link>https://dev.to/celestialchips/code-quality-checking-with-flake8-3b8k</link>
      <guid>https://dev.to/celestialchips/code-quality-checking-with-flake8-3b8k</guid>
      <description>&lt;p&gt;Flake8 is a very popular tool in the Python community it's very useful for checking the style and quality of your Python code. It's amazing for ensuring that your code adheres to &lt;code&gt;PEP 8&lt;/code&gt; guidelines and as well as for finding bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Basics
&lt;/h2&gt;

&lt;p&gt;You can use Flake8 inside of your Django application to clean up your code as well as making sure it adheres to the &lt;code&gt;PEP 8&lt;/code&gt; guidelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First we'll need to install Flake8. We'll do this using pip. Run the command below to install flake8&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install flake8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after installing flake8, we can check if flake8 has been successfully installed. By running the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 install -m flake8 --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a version number along with some other packages alongside it. It might look something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6.1.0 (mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.1.0) CPython 3.12.0 on
Darwin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're going configure Flake8 to ignore certain files or errors, or to adjust its complexity thresholds. Go into your projects root and create a .flake8 file with these configurations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[flake8]
ignore = E501, W503
exclude = .git,__pycache__,old,build,dist
max-complexity = 10

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These configuration's tell flake8 a few things:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ignore&lt;/code&gt;: Is a list of error codes to ignore.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;exclude&lt;/code&gt;: Directories or files to exclude from any checks.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;max-complexity&lt;/code&gt;: Sets the maximum allowed McCabe complexity for your functions.&lt;/p&gt;

&lt;p&gt;If you want to know more about you can learn more here &lt;a href="https://en.wikipedia.org/wiki/Cyclomatic_complexity"&gt;McCabe Complexity&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Executing Flake8
&lt;/h2&gt;

&lt;p&gt;Time to run &lt;code&gt;Flake8&lt;/code&gt; manually by executing the flake8 command in your project's root directory. This will check all Python files in your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flake8 path/to/your/project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Automating Flake8&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To automate the execution of flake8 process, you can integrate &lt;code&gt;Flake8&lt;/code&gt; checks into your development workflow. You can be do this in a few ways.&lt;/p&gt;

&lt;p&gt;You can use something such as Pre-commit Hooks, which are tools like &lt;code&gt;pre-commit&lt;/code&gt; to run Flake8 before each commit.&lt;/p&gt;

&lt;p&gt;You can also run Flake8 as part of your CI pipeline using tools like GitHub Actions, GitLab CI, or Jenkins.&lt;/p&gt;

&lt;p&gt;Flake8 will report back any stylistic errors or code smells that it finds. Each issue is reported with a code that you can look up in the Flake8 documentation to understand more about the issue and how to fix it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Error Codes&lt;/strong&gt;&lt;br&gt;
There could be a few error codes that come out when executing flake8. Here are some of the most common ones along with an explanation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pyflakes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PyFlakes checks for logical errors within your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;F401: 'module' imported but unused
F821: undefined name 'name'
F403: 'from module import *' used; unable to detect undefined names
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;pycodestyle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;pycodestyle focuses on style according to the &lt;code&gt;PEP 8&lt;/code&gt; guidelines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;E501: Line too long (more than 79 characters)
E302: Expected 2 blank lines, found 1
E305: Expected 2 blank lines after class or function definition, found 1
W291: Trailing whitespace
E303: Too many blank lines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;McCabe&lt;/strong&gt;&lt;br&gt;
Finally, McCabe checks the complexity of your code.&lt;/p&gt;

&lt;p&gt;C901: 'function' is too complex (the score)&lt;/p&gt;

&lt;p&gt;After identifying issues, you should fix them to improve the quality and readability of your code. This might involve reformatting code, reducing complexity, or adhering more closely to PEP 8 guidelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IDE Integration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many IDEs like PyCharm, VSCode have Flake8 integration or plugins, which can help you identify issues as you code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optionally&lt;/strong&gt;&lt;br&gt;
Flake8 can be used in conjunction with other tools like Black (for code formatting) and isort (for import sorting) to further enhance code quality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Notes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While Flake8 is a very valuable tool for maintaining code quality, it's not a substitute for good coding practices or code reviews. It's best used as part of a broader quality assurance strategy.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>programming</category>
      <category>python</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Setting up your first Django Project</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Thu, 21 Dec 2023 02:17:29 +0000</pubDate>
      <link>https://dev.to/celestialchips/setting-up-your-first-django-project-35d7</link>
      <guid>https://dev.to/celestialchips/setting-up-your-first-django-project-35d7</guid>
      <description>&lt;p&gt;There's lots of frameworks out there and Django is probably one of the more difficult ones to learn. There's lots tutorials on how to setup Django like the documentation &lt;a href="https://docs.djangoproject.com/en/5.0/intro/tutorial01/"&gt;Django Tutorials&lt;/a&gt; but if you're like me and have ADHD. I tend to lose focus real quick when reading documentation. Use a screen reader they really help get that feedback your brain craves.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Basics
&lt;/h2&gt;

&lt;p&gt;Let's get started on the basics. If you didn't know, Django is a Python web framework. So if you don't have Python installed on your system head over to &lt;a href="https://www.python.org/downloads/"&gt;Python&lt;/a&gt; main webpage and download the interpreter for your respective system. You can check if python is installed on your system by running this command in your terminal. Make sure you're running Python3 as Python2 has been deprecated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once Python is installed, you can now install Django using pip, which is Python's package installer. Open your terminal interface and run the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install django
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installing Django, you can check if it's installed correctly by using the command. This command does two things &lt;code&gt;-m&lt;/code&gt; flag which runs the library module as a script and then checks Django's version with the &lt;code&gt;--version&lt;/code&gt; flag. Which should output some number of the Django version currently installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m Django --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you already have Django installed make sure you upgrade to the latest package using the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install --upgrade Django
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WOW! That was a lot you learned how to install python and how to install Django on your system! Be proud you did it! &lt;/p&gt;

&lt;h2&gt;
  
  
  Django Project Creation
&lt;/h2&gt;

&lt;p&gt;you can now finally create a new project with your new shiny framework Django. In your terminal, navigate to the directory where you want your project to be and run. I'm going to put this on my Desktop for simplicity. Run the command below to create a new folder on your desktop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir myfirstdjangoproject &amp;amp;&amp;amp; cd myfirstdjangoproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command does two things.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir&lt;/code&gt; runs a command to create a directory in your current folder.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; changes your directory to the directory you just created.&lt;/p&gt;

&lt;p&gt;Finally we can run this command. What we're doing here is invoking &lt;code&gt;Django-admin&lt;/code&gt; when the Django module is ran as a script. We then run a subcommand &lt;code&gt;startproject&lt;/code&gt; which creates our project. Then at the end you have your project name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject myfirstproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to your newly created &lt;code&gt;myfirstproject&lt;/code&gt; folder using the change directory command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd myfirstproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can finally run the command to show that Django has been setup correctly. Django comes with a built-in development server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 manage.py runserver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command does one thing it executes the script that Django created when you created your project and then runs the subcommand &lt;code&gt;runserver&lt;/code&gt; which runs Django's built-in server.&lt;/p&gt;

&lt;p&gt;You should see output in the terminal indicating the server is running by default it runs on the localhost at port &lt;code&gt;8000&lt;/code&gt;. You can change this port if you want to, but we'll keep it as is. Head over to your Web browser and enter or copy and paste the address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:8000/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a welcome page from Django.&lt;/p&gt;

&lt;p&gt;Woo, that was a lot! Django is all setup and you're ready to change the world now. To recap you've learnt how to setup and create a Django project and start the server using the &lt;code&gt;runserver&lt;/code&gt; command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating your first app
&lt;/h2&gt;

&lt;p&gt;To create an app within your project execute this command in the terminal using if you follow the &lt;a href="https://docs.djangoproject.com/en/5.0/intro/tutorial01/"&gt;Django&lt;/a&gt; documentation you can name it polls app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py startapp myappname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, Django does not know where your application is at so make sure you add it inside of your settings.py file under &lt;code&gt;INSTALLED_APPS&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = [
    'myappname',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you do not do this then you won't be able to work with your application inside of Django.&lt;/p&gt;

&lt;h2&gt;
  
  
  About Django
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Batteries Included&lt;/strong&gt;&lt;br&gt;
Django is Batteries Included meaning you have pretty much everything you need to get your app off of the ground there's a login system, you have a db connection, you have crud like operations out of the box. So you don't have to worry about setting any of that up.&lt;/p&gt;

&lt;p&gt;Django uses a model-template-view (MTV) architectural pattern. This means in order to work with Django you'll need to create models, views, and templates. The models.py, views.py have been created for you when you used the &lt;code&gt;startapp&lt;/code&gt; command, but the templates folder needs to be created by you inside of your project in order for Django to render any HTML content.&lt;/p&gt;

&lt;p&gt;Inside of your models.py you'll see an empty file with an import statement at the top. Something like. This is how where you'll create your database schema.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.db import models

# Models go here

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, Django uses SQLite which is great for development but once you move to production try your hands at using a Database like PostgreSQL. Once you've created your database schema, run the commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py makemigrations
python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands will invoke your manage.py script and will run two subcommands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;makemigrations&lt;/code&gt; - which is responsible for creating new migrations based on the changes you have made to your models.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;migrate&lt;/code&gt; - which is responsible for applying and unapplying migrations.&lt;/p&gt;

&lt;p&gt;Django comes with a built-in admin panel. You need to create a superuser to access it. Simply run the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py createsuperuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts to create the user.&lt;br&gt;
Access the Admin Panel. Once created run the server using the &lt;code&gt;runserver&lt;/code&gt; command. In your web browser navigate to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:8000/admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's really it continue developing your application by adding more models, views, URLs, and templates as needed. You can always refer back to the &lt;a href="https://docs.djangoproject.com/en/5.0/"&gt;Django&lt;/a&gt; documentation if you feel like this tutorial wasn't thourough enough on setting up your first Django project.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>python</category>
    </item>
    <item>
      <title>Setup and Securing RabbitMQ</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Sun, 17 Dec 2023 23:57:45 +0000</pubDate>
      <link>https://dev.to/celestialchips/rabbitmq-setup-1o73</link>
      <guid>https://dev.to/celestialchips/rabbitmq-setup-1o73</guid>
      <description>&lt;p&gt;&lt;strong&gt;Changing the default username and password in RabbitMQ&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, access the command line on the server where RabbitMQ is installed in this case we used Homebrew to install our RabbitMQ server.&lt;/p&gt;

&lt;p&gt;We can create a new user with a custom username and password using the &lt;code&gt;rabbitmqctl command&lt;/code&gt;. Replace &lt;code&gt;new_username&lt;/code&gt; and &lt;code&gt;new_password&lt;/code&gt; with your desired credentials.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl add_user new_username new_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After creating the new user, you want to set permissions for this user. You can set permissions to allow the user to access all vhosts (/ is the default vhost). The command below will give the user permissions to read, write, and configure queues on the default vhost. Adjust the permissions according to your needs. &lt;/p&gt;

&lt;p&gt;using &lt;code&gt;set_permissions -h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;we see that we can supply a username and its permissions under   &lt;/p&gt;

&lt;p&gt;&lt;code&gt;[--node &amp;lt;node&amp;gt;] [--longnames] [--quiet] set_permissions [--vhost &amp;lt;vhost&amp;gt;] &amp;lt;username&amp;gt; &amp;lt;conf&amp;gt; &amp;lt;write&amp;gt; &amp;lt;read&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl set_permissions -p / new_username ".*" ".*" ".*"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Optionally, If the new user needs to have administrative access, you can set the user tag to administrator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl set_user_tags new_username administrator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, RabbitMQ creates a &lt;code&gt;guest&lt;/code&gt; user with the password with world's strongest password for simplicity &lt;code&gt;guest&lt;/code&gt;, but for security reasons, we will change the default user's password or delete the user. To change the password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl change_password guest new_guest_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you'd rather delete the guest user you can use this command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl delete_user guest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After making all the changes needed, you should restart the RabbitMQ service to make sure all changes are applied and avoid conflicts. You can do this using your system's service management commands.&lt;br&gt;
Since we're using Homebrew we will use the &lt;code&gt;brew&lt;/code&gt; command.&lt;br&gt;
If you're on linux you can choose to &lt;code&gt;sudo systemctl&lt;/code&gt; commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services restart rabbitmq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, verify that the changes have been applied correctly. You can list users to see if your new user is created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl list_users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it, RabbitMQ should be all setup and secured!&lt;/p&gt;

</description>
      <category>rabbitmq</category>
      <category>tutorial</category>
      <category>homebrew</category>
    </item>
    <item>
      <title>Setting up RabbitMQ for Automated Celery Tasks via Homebrew</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Sun, 17 Dec 2023 21:35:24 +0000</pubDate>
      <link>https://dev.to/celestialchips/setting-up-rabbitmq-for-automated-celery-tasks-via-homebrew-20mb</link>
      <guid>https://dev.to/celestialchips/setting-up-rabbitmq-for-automated-celery-tasks-via-homebrew-20mb</guid>
      <description>&lt;p&gt;The easiest way to install RabbitMQ on macOS is using Homebrew the new and shiny package management system for macOS.&lt;/p&gt;

&lt;p&gt;Here's a general step by step guide:&lt;/p&gt;

&lt;p&gt;If you don't already have it install Homebrew, you can install it by running the following command in the Terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once Homebrew is installed, you can install RabbitMQ by running this command will download and install RabbitMQ with its dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install rabbitmq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installation, you might need to add RabbitMQ to your PATH. You can do this by adding the following line to your .bash_profile, .zshrc. This step ensures that you can run RabbitMQ commands from the Terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PATH=$PATH:/usr/local/sbin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Starting/Stopping the RabbitMQ server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, we can start up RabbitMQ using Homebrew, the command below ensures that RabbitMQ will run automatically at login.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services start rabbitmq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Optionally, If you would like to verify the installation of RabbitMQ and ensure it's up and running correctly, you can check its status by running the status command, it will provide you information on the RabbitMQ service status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmqctl status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, if you would like to stop RabbitMQ services for any reason you can use the brew command stop the rabbitmq service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services stop rabbitmq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Running management plugin with RabbitMQ&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RabbitMQ also comes with a management plugin that provides a browser-based UI for managing and monitoring your RabbitMQ server. If you would like to monitor the stats of your RabbitMQ server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rabbitmq-plugins enable rabbitmq_management
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After enabling it, you can access the management console through &lt;code&gt;http://localhost:15672/&lt;/code&gt;. By default the username and password are both “guest”.&lt;/p&gt;

&lt;p&gt;Finally to keep RabbitMQ updated you can use Homebrew commands for &lt;code&gt;update&lt;/code&gt; and &lt;code&gt;upgrade&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew update
brew upgrade rabbitmq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you encounter any issues during setup it might also be worth checking the official RabbitMQ &lt;a href="https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/rabbitmq.html#broker-rabbitmq"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>celery</category>
      <category>rabbitmq</category>
      <category>homebrew</category>
    </item>
    <item>
      <title>Setting up PgAdmin4 with Homebrew</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Sun, 17 Dec 2023 19:40:39 +0000</pubDate>
      <link>https://dev.to/celestialchips/setting-up-pgadmin4-with-homebrew-1pp0</link>
      <guid>https://dev.to/celestialchips/setting-up-pgadmin4-with-homebrew-1pp0</guid>
      <description>&lt;p&gt;There are a few ways of setting up PgAdmin4 you can download it from the official website &lt;a href="https://www.pgadmin.org"&gt;pgadmin&lt;/a&gt; or you can set it up with homebrew. I like homebrew so we're going to do it that way!&lt;/p&gt;

&lt;p&gt;Here's how you can do it too!&lt;/p&gt;

&lt;p&gt;First, It's always a good practice to update Homebrew to ensure you get the latest versions of software.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we can install pgAdmin 4 using Homebrew by executing the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --cask pgadmin4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the installation is complete, you can launch pgAdmin 4. &lt;/p&gt;

&lt;p&gt;You might find it in your Applications folder, or you can start it using the Finder search (Cmd + Spacebar, then type "pgAdmin 4").&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Connecting to your PostgreSQL Database&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When you first open pgAdmin 4, you'll need to set a master password for the pgAdmin application itself. This is different from your PostgreSQL credentials.&lt;/p&gt;

&lt;p&gt;To connect to your local PostgreSQL database, right-click on &lt;code&gt;Servers&lt;/code&gt; in the left-hand browser pane, and a dropdown will appear&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Register  &amp;gt; Server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Create  &amp;gt; Server Group&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for all intents and purposes we're going to create a new server group.&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;Create  &amp;gt; Server Group&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Create - Server Group&lt;/code&gt; dialog, enter a name for the connection in the &lt;code&gt;Name&lt;/code&gt; field. Your new server group will come up in the left pane. Right click the server name you just created and click &lt;code&gt;Register &amp;gt; Server&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Make sure you give the server a name and then switch to the &lt;code&gt;Connection&lt;/code&gt; tab, and enter the following details, We're going to create a locally running postgreSQL database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hostname/address: localhost
Port: 5432 (default PostgreSQL port)
Maintenance database: postgres
Username: Your PostgreSQL SuperUsername
Password: Your PostgreSQL user's password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: You can save the password for ease of use later.&lt;/p&gt;

&lt;p&gt;Remember to ensure that your PostgreSQL server is running when you try to connect via pgAdmin 4. If you face any issues with the connection, verify that PostgreSQL is active (using brew services list) and that the connection details in pgAdmin 4 are correct and that's it. &lt;/p&gt;

&lt;p&gt;You can now use pgAdmin 4 to manage your PostgreSQL databases, create tables, run queries, and much more, all through a user-friendly interface.&lt;/p&gt;

</description>
      <category>homebrew</category>
      <category>postgressql</category>
      <category>macos</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Setting up Postgres via Homebrew</title>
      <dc:creator>Ryan Glass</dc:creator>
      <pubDate>Sun, 17 Dec 2023 18:38:53 +0000</pubDate>
      <link>https://dev.to/celestialchips/setting-up-postgres-via-homebrew-2lbe</link>
      <guid>https://dev.to/celestialchips/setting-up-postgres-via-homebrew-2lbe</guid>
      <description>&lt;p&gt;Setting up PostgreSQL using Homebrew is quick easy and painless, Here's a detailed guide to help you through the process:&lt;/p&gt;

&lt;p&gt;Install Homebrew if you haven't already installed Homebrew, you can do so by running the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installing PostgreSQL once Homebrew is installed, you can install PostgreSQL by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install postgresql@version_number
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initializing a Database Directory after installation, you can initialize the directory with this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services start postgresql@version_number
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check that PostgreSQL Services are running with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating a Superuser&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a Superuser, you can access the PostgreSQL interactive terminal by running the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you can create a new superuser ideally you would want to replace username with your desired username:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE ROLE username WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD 'password';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure you replace 'password' with a your super secret secure password.&lt;/p&gt;

&lt;p&gt;To exit the PostgreSQL Interactive Terminal: Type &lt;code&gt;\q&lt;/code&gt; and then press Return/Enter to quit the PostgreSQL interactive terminal.&lt;/p&gt;

&lt;p&gt;But, WAIT.. There's more...&lt;/p&gt;

&lt;p&gt;Additionally, If you have multiple versions of PostgreSQL installed, or if you want to use the &lt;code&gt;PostgreSQL@version_number&lt;/code&gt; that you installed as your default version, you can link it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew link postgresql@version_number --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally you want to verify the installation, you can verify that PostgreSQL is properly installed and the superuser is created by logging into PostgreSQL with the new user credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -U username -d postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again remember to replace username and password with your chosen username and password. Make sure to keep your password secure and avoid using simple or predictable passwords.&lt;/p&gt;

&lt;p&gt;I like to use sha256 myself for passwords, but that's an article for another time.&lt;/p&gt;

</description>
      <category>macos</category>
      <category>homebrew</category>
      <category>postgressql</category>
    </item>
  </channel>
</rss>
